开发者

How to include two namespaces with same name in a?

开发者 https://www.devze.com 2023-01-02 04:38 出处:网络
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

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

精彩评论

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

关注公众号