直接说问题:我有一个实现了两个接口的类:
public class A : Interface1, Interface2{
// Interface 1 implementation...
// Interface 2 implementation...
}
有没有一种方法(不需要创建另一个新类)使Interface1的实现内部化并将其隐藏在其他组件中(只有Interface2保持公开)?
编辑:还有一些有用的信息:Interface1和Interface2在另一个核心组件中定义为public,无法更改。
提前致谢,
internal interface Interface1
除此之外没有其他选项,因为按照定义,接口是公开契约。 - Adam Houldsworthinternal interface Interface3:Interface1
并在目标类中实现它,那么Interface1仍然是公共的,但我们会得到想要的结果。抱歉,我错了,这行不通。 - Alexander Mavrinsky