【发布时间】:2017-06-04 10:25:51
【问题描述】:
我有一个荒谬的情况(不要怪我,它是第三方软件),我需要两个引用(Erp.Contracts.BO.Quote 和 Erp.Contracts.BO.SalesOrder),但类型 Erp .Tablesets.QuoteQtyRow 在两个程序集中都有定义!
如何在代码中使用它们?
void Absurdity()
{
Erp.Tablesets.QuoteQtyRow qqr_Quote = null; //<-- my intention is to use the one from the quote assembly here.
Erp.Tablesets.QuoteQtyRow qqr_SO = null; //<-- my intention is to use the one from the sales order assembly here.
}
编译器抛出错误。即:“'Erp.Tablesets.QuoteQtyRow' 类型存在于两个程序集中。”
编辑:限制:
我没有使用此答案 Class with same name in two assemblies (intentionally) 中提供的外部别名的灵活性。我受限于第三方软件提供的环境。我本质上需要一种方法来区分方法体。
我知道我可以通过使用 dynamic 关键字完全避免这个问题,但我正在寻找一种可能的强类型解决方案。
可能没有解决方案,但我想在我放弃这个问题之前耗尽我所有的资源。
【问题讨论】:
-
@AlexeiLevenkov 我知道命名空间是什么以及如何使用必应。你能提供更具体的吗?
-
请edit 发帖,以便清楚有哪些限制,以便可以重新打开帖子(并且可能有人回答)。旁注:帖子应该展示您已经完成了哪些研究——只是您可以使用搜索引擎这一事实对于 SO 帖子本身并没有多大意义。
标签: c# namespaces epicorerp fully-qualified-naming