Hi
Is it possible in one way or another to enforce that a class only inherit
from one of the derived interfaces of a base interface of some kind. For
example.
public class MyClass2 : IMyInterface1 => OK
public class MyClass2 : IMyInterface1, IMyInterface2 => Error
Regards
/Niklas
public interface IMyInterfacsBase
{
string MyMethod1();
}
public interface IMyInterface1 : IMyInterfacsBase
{
int MyInt1{ get; }
}
public interface IMyInterface2 : IMyInterfacsBase
{
int MyInt1{ get;}
int MyInt2{ get;}
}
public class MyClass2 : IMyInterface1, IMyInterface2
{
private int _MyInt1 = 4;
private int _MyInt2 = 5;
public int MyInt1
{
get { return _MyInt1; }
}
public int MyInt2
{
get { return _MyInt2; }
}
public string MyMethod1()
{
throw new NotImplementedException();
}
}