开发者

How to include two namespaces with same name in a?

I have two n开发者_高级运维amespaces with same name. Can I refer both in same file?


Yes, you can use an alias. See How to: Use the Namespace Alias Qualifier

Two relevant pats:

global::System.Console.WriteLine(number);

This will always work, even if you have other System or Console names.

using colAlias = System.Collections;

This lets you declare an alias for a given namespace.


Here is an example

using MyNamespace1 = Namespace1.Test.ClassName;
using MyNamespace2 = Namespace2.Test.ClassName;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜