C# - 获取的参考引用 [英] C# - Getting references of reference

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

问题描述

我建立了一个类库项目,它引用了几个DLL的。在我的类库项目的构造我用一些枚举从引用的DLL之一。当使用我的类库的另一个项目是有可能不必引用添加到我的dll和那些我的类库项目引用内部?

I have built a class library project, that references a couple dll's. In the constructor of my class library project I use some enums from one of the referenced dll's. When using my class library in another project is it possible to not have to add references to my dll and the ones my class library project references internally?

推荐答案

这取决于你的意思的内部参考的。

It depends on what you mean by reference internally.

如果您的应用程序项目使用从类库A类,这个类不公开任何公共类型的其他库,第三方或没有,你不需要任何引用添加到多个包含类型的类库一。

If your application project uses type A from your class library, and that class does not expose any public types from other libraries, 3rd party or not, you don't need to add any references to more than your class library containing type A.

然而,如果A型暴露了一些公共属性,方法返回类型,或采取类型参数,或者A型是从一种类型的后裔,即位于其他一些组件,那么你就需要引用其他组件为好。

However, if type A exposes some public properties, methods returning types, or taking parameters of types, or perhaps type A is descended from a type, that is located in some other assembly, then you need a reference to that other assembly as well.

所以,如果你真的是说的在内部使用的,那么它不应该是必要的不仅仅是一个参考添加到您的类库。

So if you indeed mean uses internally, then it should not be necessary to add more than just the one reference to your class library.

但是,如果编译器抱怨,那是最重要的。

However, if the compiler complains, then that's what matters.

这篇关于C# - 获取的参考引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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