namespace Test
{
#region Not my code
public interface IAdditional
{
}
public interface ISome
{
ISomeOther<T> GetSomeother<T>() where T : class;
}
public interface ISomeOther<T> where T : class
{
void DoFoo(T obj);
}
public class AnotherClass<T> where T : class
{
}
public static class StaticClass
{
public static void DoBar<T>(AnotherClass<T> anotherClass, T obj) where T : class, IAdditional
{
}
}
#endregion
#region MyCode
public class SomeOtherImp<T> : ISomeOther<T> where T : class, IAdditional //Have to add IAdditional constraint to call StaticClass.DoBar
{
private AnotherClass<T> _anotherClass;
public void DoFoo(T obj)
{
StaticClass.DoBar<T>(_anotherClass, obj); //I do need to call StaticClass.DoBar here....
}
}
public class ISomeImp : ISome
{
public ISomeOther<T> GetSomeother<T>() where T : class
{
return new SomeOtherImp<T>(); //Can't do this no IAdditional constraint on T
}
}
#endregion
}
I was forced to add IAdditional to SomeOtherImp to be able to call StaticClass.DoBar And now I can't implement ISome with SomeOtherImp....