views:

1257

answers:

3

VB.NET automatically prefixes the root namespace set in the project properties to the namespace of each class. This is different from C#, where the full namespace must be declared each time.

Is it possible to override this behaviour, creating a namespace outside of the root namespace?

+6  A: 

If I understand you correctly you just need to set a blank namespace in the project properties dialog and then set namespaces within each source file using Begin/End Namespace commands.

RobS
+3  A: 

You can change the namespace of the entire project by going to properties on the project. else you will have to have a empty root namespace and set the name space in each file with the

Namespace test
    class.....
End Namespace
Petoj
+3  A: 

Defining the default for the project as blank and then taking total control in each class allows you to do what c# does. However certain project types (Library I believe) do not allow you to change the default namespace to blank.

Use of the Global keyword does not allow you to jump out of the root namespace either: http://msdn.microsoft.com/en-us/library/16czfx55.aspx

ShuggyCoUk