抱歉,如果这是重复的,我想是的,但我没有找到任何东西.我可能找错人了.
public interface IMyThingA {}
public class A : IMyThingA {}
interface IMyThingB {
IMyThingA SomeThingA { get; set; }
}
public class B : IMyThingB { // B does not implement interface member 'IMyThingA.SomeThingA'
public A SomeThingA;
}
在上面的代码中,我期望类B
能够使用一个实现预期接口(IMyThingA
)的类,但显然我错了.有没有一种方法可以让这样的模式发挥作用?