views:

37

answers:

2

Hi,

I have two namespaces with same name. Can I refer both in same file?

+1  A: 

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.

Matthew Flaschen
Can u give me with an example ?
Anish
Thanks alot ...
Anish
+1  A: 

Here is an example

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