不同程序集的C#继承 [英] C# Inheritance with Different Assembly

查看:71
本文介绍了不同程序集的C#继承的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我在程序集A中具有基本功能的A类。我不想改变这个项目。

i have class A in assembly A with base functionality. i don't want to alter in this project.

second 我在程序集B中有B类,其中B覆盖A的功能

second  i have class B in assembly B where B overrides functionality of A 

现在我想访问C语言中的A的属性/方法。

now i want to access Properties/method of A in Class C which is in Assembly C.

其中 我在C中添加了B的参考。

where  i had added reference of B in C.

我怎么能?

推荐答案

这取决于你想要什么。什么是C级?它是否继承自A / B?

It is depend on what you want. What is class C? Is it inherited from A/B or not?

如果要在C中使用A类,可以在C中添加对A的引用,但不能访问B类。如果你想在C中使用B,那么将添加程序集A,因为B使用它。 

When you want to use class A in C, you can add reference to A in C but class B will not be accessible. When you want to use B in C then assembly A will be added because B uses it. 


这篇关于不同程序集的C#继承的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆