lurscher
lurscher

Reputation: 26943

namespace being shadowed

so I have a library Mine.SuperFun which calls stuff in the library SuperFun whose main namespace is SuperFun. The problem i'm having is that i can't address classes or basically anything in the SuperFun library inside classes in the Mine.SuperFun.XyZFoo namespaces

The only way to address them i have is doing stuff like:

using SuperFun_NiceClass = SuperFun.NiceClass;

using Mine.SuperFun {

...

SuperFun_NiceClass.DoStuff()

is there something i can do (besides changing the namespace in Mine library) to be able to address those classes directly?

Upvotes: 2

Views: 163

Answers (1)

Eric J.
Eric J.

Reputation: 150108

You can use the global contextual keyword

What is the usage of global:: keyword in C#?

http://msdn.microsoft.com/en-us/library/cc713620.aspx

namespace Mine.SuperFun
{
    public class My { public int a; }
}

namespace SuperFun
{
    public class Theirs { public int a; }
}

namespace SomeProgram
{
    public class Program
    {
        SuperFun.Theirs theirs;
        global::Mine.SuperFun.My mine;
    }
}

Upvotes: 2

Related Questions