Interviews15 answers
Can class exists without namespace
15 Answers
No. If you do not provide namespace .net will automatically pick default namespace. Default Can be found in project properties.
Vishal JadavPosted Aug 15, 2016, 2:54 AM EDT
YES
zhang shiPosted Feb 28, 2016, 8:12 PM EST
The correct answer is No.
But in terms of .net implementation part you can create without namespace and compiler will add that class under namespace at run time.
Prasoon AbhinawPosted Sep 4, 2015, 9:53 PM EDT
Yes
Ajay GandhiPosted Aug 25, 2015, 3:49 AM EDT
yes
Piyush chhabraPosted Apr 20, 2015, 3:50 AM EDT
yes
Piyush chhabraPosted Apr 20, 2015, 3:50 AM EDT
yes...
Sunil GadedPosted Aug 28, 2014, 2:31 AM EDT
yes,ofcourse
Bhabani PrasadPosted May 23, 2014, 4:59 AM EDT
class can exists without namespace. class without namespace cannot be accessed in other namespace.
Dasharath VishwakarmaPosted May 19, 2014, 8:38 PM EDT
yes
Rakesh SinghPosted Apr 23, 2014, 11:28 PM EDT
yes
Munesh SharmaPosted Apr 12, 2014, 1:12 AM EDT
No
ashok rathodPosted Apr 7, 2014, 3:20 AM EDT
It is impossible to create a class without having a namespace . But in asp.net we can create a class without having a namespace , in this case asp.net compiler will add a namespace called global under which the classes will be added .
For testing this open an asp.net website create class with the name Class1 in a.aspx.cs file , create one more file with the same class name that is Class1 . Now try to compile and execute code . You will definitely get an error stating global namespace is already having the class with the name Class1 .
Hence it is not possible to create a class without a name space ( incase of asp.net if you skip namespace asp.net will create one for you with the name global )
Palle TechnologiesPosted Apr 1, 2014, 11:59 PM EDT
Yes,
namespace is used to just grouping and it is not mandatory.
shimab alamPosted Mar 20, 2014, 3:21 AM EDT








