using Foo.Uber;
namespace MyStuff.Foo
{
class SomeClass{
void DoStuff(){
// I want to reference the outer "absolute" Foo.Uber
// but the compiler thinks I'm refering to MyStuff.Foo.Uber
var x = Foo.Uber.Bar();
}
}
}
How could I solve this? Just moving the using statement inside my namespace doesn't help.
You can do this using a namespace alias qualifier (typically global::
) to refer to the default / root namespace:
global::Foo.Uber
Alias the namespace in the using statement:
using ThatOuterFoo = Foo.Uber;
...
...
//Some time later...
var x = ThatOuterFoo.Bar();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With