You can't do this in C# - any class can implement any interface it has access to.
Why would you want to do this? Bear in mind that by declaring an interface inheritance:
public interface InterfaceA {}
public interface InterfaceB : InterfaceA {}
You're specifying that anything implementing InterfaceB
also has to implement InterfaceA
, so you'll get classes implementing InterfaceA
anyway.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…