Namespace Collisions

I was playing around with MfGames.GtkExt (new namespace) and the sprite library. I've always had a problem with the namespaces, mainly since I want to use ".Gtk" but it caused problems with the "Gtk" namespace from gtk-sharp. So, I decided to figure out the exact limitation.

namespace Bob
{
	public class AA {}
}

namespace B.Bob { using Bob;

public class BB : Bob.AA {}

}

The above doesn't work. It gives an error, but interestingly, the following works:

namespace A.Bob
{
	public class AA {}
}

namespace B.Bob { using A.Bob;

public class BB : AA {}

}

So, that means you can't have a sub-namespace with the same name as the top-level one. So, if you have "Gtk", you can't have a sub-namespace of "Gtk" because both the VS and mono have a problem with it. On the other hand, I can use "GtkExt" for both the sprite library and the MfGames.GtkExt without a problem.

Metadata

Categories:

Tags: