Compiler optimizations with generics

c#
public interface Isome<T> where T: ISomeOther
{
T Foo();
}
//vs

public interface ISome
{
ISomeOther Bar();
}


public class A : ISome<SomeOther> //where SomeOther : ISomeOther
{
SomeOther Foo();
}
//vs

public class B : ISome
{
SomeOther Bar(); //where SomeOther : ISomeOther
}
c#
public interface Isome<T> where T: ISomeOther
{
T Foo();
}
//vs

public interface ISome
{
ISomeOther Bar();
}


public class A : ISome<SomeOther> //where SomeOther : ISomeOther
{
SomeOther Foo();
}
//vs

public class B : ISome
{
SomeOther Bar(); //where SomeOther : ISomeOther
}
Is the implementation of A and B semantically equivalent or is there some Boxing/Unboxing/polymorphism going on with the Implementation of B? Meaning that A would be more efficient Because of static compiler optimizations with generics?
1 Reply
nightooi /s I'm rarely serious
Okay, im just calling Foo/Bar from the implemented classes. I'm doing a factory with a interface as base so, should be fine. Thanks!