在C#中引用继承

在C#中引用继承

本文介绍了在C#中引用继承的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下问题:

我有接口 IA 在ProjectA.dll和 IB 在ProjectB.dll( IB 继承 IA )。当我尝试实施 IB 中的任何其他项目两个引用是必需的。好了,关于ProjectB.dll参考的需求的预期,但我有点困惑,即需要对ProjectA.dll的参考了。

I have interfaces IA in the ProjectA.dll and IB in the ProjectB.dll (IB inherits IA). When I try to implement IB in any another project the both references are required. Well, the requirement of a reference on the ProjectB.dll is expected, but I was little bit confused, that a reference on the ProjectA.dll is needed too.

请问谁知道怎么叫这个功能,我在哪里可以找到有关此问题的详细信息?

Does anybody know how is this feature called and where can I find detailed information about this behavior?

推荐答案

您将需要一个参考所有包含涉及您可以实现任何接口的类的组件。否则,运行时怎么会知道任何这种类的定义是什么?

You'll need a reference to all of the assemblies that contain the classes involved in any interface you might implement. Otherwise, how will the runtime know what the definition of any such class is?

这篇关于在C#中引用继承的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 20:03