views:

109

answers:

2

Hi,

I have two namespaces:

1) Foo.Bar

2) Another.Foo.Bar

From a class in namespace 2, how do I reference a class in namespace 1? Using Foo.Bar leaves you in namespace 2 still...

I hope this is reasonably clear!

Thanks.

A: 
Joel Coehoorn
This doesn't work for me (C#) :/ They are in different assemblies though - perhaps that is something to do with it.
UpTheCreek
+7  A: 

You need to use the global qualifier.

Just add:

using GFooBar = global::Foo.Bar;

Then refer to it as:

GFooBar.MyClass = new GFooBar.MyClass();

or

global::Foo.Bar.MyClass = new global::Foo.Bar.MyClass();
Reed Copsey
Worked a treat - thank you :)
UpTheCreek