15
Reply

Can class exists without namespace

shimab alam

shimab alam

10y
8.5k
0
Reply

    yes

    No. If you do not provide namespace .net will automatically pick default namespace. Default Can be found in project properties.

    YES

    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.

    Yes

    yes

    Yes

    yes...

    yes,ofcourse

    class can exists without namespace. class without namespace cannot be accessed in other namespace.

    yes

    yes

    No

    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 )

    Yes, namespace is used to just grouping and it is not mandatory.