What namespace will a class have if no namespace is defined

后端 未结 3 2167
半阙折子戏
半阙折子戏 2020-11-30 08:33

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         


        
3条回答
  •  情话喂你
    2020-11-30 08:55

    It's in the global namespace and can be referenced like this:

    var x = new global::test();

提交回复
热议问题