问题描述
今天我面临着一个奇怪的挑战......
这个挑战涉及我需要从我的应用程序中引用的两个 .NET 库.两者我都无法控制,并且在它们中具有相同的命名空间.
所以...
我的 foo.dll 包含一个 Widget 类,该类位于 Blue.Red.Orange 命名空间中.
我的 bar.dll 还包含一个 Widget 类,该类也位于 Blue.Red.Orange 命名空间中.p>
最后,我的应用程序需要同时引用 foo.dll 和 bar.dll.这是需要的,因为在我的应用程序中,我需要使用 foo 中的 Widget 类以及 bar 中的 Widget 类>
那么,问题是如何管理这些引用,以便确定我使用的是正确的 Widget 类?
如前所述,我无法控制 foo 或 bar 库,它们就是它们的本来面目,无法更改.但是,我可以完全控制我的应用程序.
您需要使用 extern alias - 在 C# 2 中引入.
Anson Horton 在他的博客上有一个演练,您可以觉得有用.
Today I am faced with a curious challenge...
This challenge involves two .NET libraries that I need to reference from my application. Both of which I have no control over and have the same namespace within them.
So...
I have foo.dll that contains a Widget class that is located on the Blue.Red.Orange namespace.
I have bar.dll that also contains a Widget class that is also located on the Blue.Red.Orange namespace.
Finally I have my application that needs to reference both foo.dll and bar.dll. This is needed as within my application I need to use the Widget class from foo and also the Widget class from bar
So, the question is how can I manage these references so that I can be certain I am using the correct Widget class?
As mentioned, I have no control over the foo or bar libraries, they are what they are and cannot be changed. I do however have full control over my application.
You need to use an extern alias - introduced in C# 2.
Anson Horton has a walkthrough on his blog which you may find useful.
这篇关于.NET - 具有相同命名空间的多个库 - 引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)