In C#, if I create a class with no namespace, what namespace will I use when trying to instantiate the class?
For example, assume main is...
namespac
It's in the global namespace and can be referenced like this:
var x = new global::test();
In the addition to above answers, it is important to note, what all Type, regardless of its declaration location, has a "fully qualified name", which begins from "global::"
From "O'Relly. C# in a Nutshell":
All type names are converted to fully qualified names at compile time. Intermediate Language (IL) code contains no unqualified or partially qualified names
Types not defined within a namespace will be in the global namespace.
The global contextual keyword, when it comes before the :: operator, refers to the global namespace, which is the default namespace for any C# program and is otherwise unnamed.
The following example shows how to use the global contextual keyword to specify that the class TestApp is defined in the global namespace:
C# class TestClass : global::TestApp { }