what I want is that if class A implements my interface (B) I also want A being forced to implement an interface/type derived from type C.
In code, the result would look like this:
public interface SomeInterface
{
// implementing this interface forces the implementing class to also implement
// a derived interface/type of SomeBaseInterface
void SomeMethod();
}
public interface SomeBaseInterface
{
void SomeBaseMethod();
}
public interface SomeOtherInterface : SomeBaseInterface
{
void SomeOtherMethod();
}
public class ImplementingClass : SomeInterface, SomeOtherInterface // <- if not
// implementing an interface/type derived from SomeBaseInterface
// this should not compile
{
public void SomeMethod()
{
}
public void SomeOtherMethod()
{
}
public void SomeBaseMethod()
{
}
}
*edit
it would also work to 'mark' not possible, see C# Interfaces- only implement an interface in other interfacesSomeBaseInterface
as not inheritable by a class. Meaning that only another interface/abstract class can inherit from it.