全局命名空间问题 [英] Global namespace problem

查看:96
本文介绍了全局命名空间问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个外部程序集A1和A2,它们都在全局

名称空间中定义了类X.我需要在我的VB项目中使用这两个程序集,但名称X是

不明确。我怎样才能解决这个问题?


有没有办法引用装配,f.ex。 A1.X和A2.X(此语法

无法编译)。


或者我可以在Imports指令中更改名称X吗?再问题是

如何在程序集A1和A2中引用2个不同的X'':


导入A1_X = A1.X''不编译


BTW,有没有办法明确引用全局命名空间,比如C ++

::?


有什么好主意吗?

I have 2 external assemblies A1 and A2 that both define class X in the global
namespace. I need to use both assemblies in my VB project but the names X are
ambiguous. How can I get around this problem?

Is there a way to refer to the assembly, f.ex. A1.X and A2.X (this syntax
does not compile).

Or can I change the name X in the Imports directive? Again the problem is
how do I refer to the 2 different X''es in assemblies A1 and A2:

Imports A1_X = A1.X '' Does not compile

BTW, is there any way to explicitly refer to the global namespace, like C++
::?

Any bright ideas out there?

推荐答案

" anders" <一个**** @ discussions.microsoft.com> schrieb
"anders" <an****@discussions.microsoft.com> schrieb
我有2个外部程序集A1和A2,它们都在全局命名空间中定义了类X.我需要在我的VB项目中使用这两个程序集
但名称X是不明确的。我怎样才能解决这个问题?

有没有办法参考装配,f.ex。 A1.X和A2.X(这个
语法不能编译)。

或者我可以在Imports指令中更改名称X吗?
问题是如何在程序集A1
和A2中引用2个不同的X'':

进口A1_X = A1.X''不编译

BTW,有没有办法明确地引用全局命名空间,像C ++那样::?

有什么好主意吗?
I have 2 external assemblies A1 and A2 that both define class X in
the global namespace. I need to use both assemblies in my VB project
but the names X are ambiguous. How can I get around this problem?

Is there a way to refer to the assembly, f.ex. A1.X and A2.X (this
syntax does not compile).

Or can I change the name X in the Imports directive? Again the
problem is how do I refer to the 2 different X''es in assemblies A1
and A2:

Imports A1_X = A1.X '' Does not compile

BTW, is there any way to explicitly refer to the global namespace,
like C++ ::?

Any bright ideas out there?



您是否离开了根名称空间?这两个组件是空的?如果你没有
,你可以使用完全合格的名字。

Armin


Did you leave the "root namespace" of the two assemblies empty? If you
didn''t, you can use the full qualified name.
Armin


Armin,你如何设置root命名空间?关于

命名空间heirchy

-

休斯顿丹尼斯

" Armin Zingler"写道:
Armin, how do you set the root namespace? I get very confused regarding the
namespace heirchy
--
Dennis in Houston
"Armin Zingler" wrote:
" anders" <一个**** @ discussions.microsoft.com> schrieb
"anders" <an****@discussions.microsoft.com> schrieb
我有2个外部程序集A1和A2,它们都在全局命名空间中定义了类X.我需要在我的VB项目中使用这两个程序集
但名称X是不明确的。我怎样才能解决这个问题?

有没有办法参考装配,f.ex。 A1.X和A2.X(这个
语法不能编译)。

或者我可以在Imports指令中更改名称X吗?
问题是如何在程序集A1
和A2中引用2个不同的X'':

进口A1_X = A1.X''不编译

BTW,有没有办法明确地引用全局命名空间,像C ++那样::?

有什么好主意吗?
I have 2 external assemblies A1 and A2 that both define class X in
the global namespace. I need to use both assemblies in my VB project
but the names X are ambiguous. How can I get around this problem?

Is there a way to refer to the assembly, f.ex. A1.X and A2.X (this
syntax does not compile).

Or can I change the name X in the Imports directive? Again the
problem is how do I refer to the 2 different X''es in assemblies A1
and A2:

Imports A1_X = A1.X '' Does not compile

BTW, is there any way to explicitly refer to the global namespace,
like C++ ::?

Any bright ideas out there?



您是否离开了根名称空间?这两个组件是空的?如果你没有,你可以使用完全合格的名字。

Armin


Did you leave the "root namespace" of the two assemblies empty? If you
didn''t, you can use the full qualified name.
Armin



请详细说明。你失去了我!


" Armin Zingler"写道:
Can you elaborate, please. You have lost me!

"Armin Zingler" wrote:
" anders" <一个**** @ discussions.microsoft.com> schrieb
"anders" <an****@discussions.microsoft.com> schrieb
我有2个外部程序集A1和A2,它们都在全局命名空间中定义了类X.我需要在我的VB项目中使用这两个程序集
但名称X是不明确的。我怎样才能解决这个问题?

有没有办法参考装配,f.ex。 A1.X和A2.X(这个
语法不能编译)。

或者我可以在Imports指令中更改名称X吗?
问题是如何在程序集A1
和A2中引用2个不同的X'':

进口A1_X = A1.X''不编译

BTW,有没有办法明确地引用全局命名空间,像C ++那样::?

有什么好主意吗?
I have 2 external assemblies A1 and A2 that both define class X in
the global namespace. I need to use both assemblies in my VB project
but the names X are ambiguous. How can I get around this problem?

Is there a way to refer to the assembly, f.ex. A1.X and A2.X (this
syntax does not compile).

Or can I change the name X in the Imports directive? Again the
problem is how do I refer to the 2 different X''es in assemblies A1
and A2:

Imports A1_X = A1.X '' Does not compile

BTW, is there any way to explicitly refer to the global namespace,
like C++ ::?

Any bright ideas out there?



您是否离开了根名称空间?这两个组件是空的?如果你没有,你可以使用完全合格的名字。

Armin


Did you leave the "root namespace" of the two assemblies empty? If you
didn''t, you can use the full qualified name.
Armin



这篇关于全局命名空间问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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