15
Reply

Can class exists without namespace

shimab alam

shimab alam

Mar 20, 2014
8.5k
0

    yes

    Piyush chhabra
    April 20, 2015
    1

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

    Vishal Jadav
    August 15, 2016
    0

    YES

    zhang shi
    February 29, 2016
    0

    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 Abhinaw
    September 05, 2015
    0

    Yes

    Ajay Gandhi
    August 25, 2015
    0

    yes

    Piyush chhabra
    April 20, 2015
    0

    Yes

    Kml Surani
    April 15, 2015
    0

    yes...

    Sunil Gaded
    August 28, 2014
    0

    yes,ofcourse

    Bhabani Prasad
    May 23, 2014
    0

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

    yes

    Rakesh Singh
    April 24, 2014
    0

    yes

    Munesh Sharma
    April 12, 2014
    0

    No

    ashok rathod
    April 07, 2014
    0

    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 Technologies
    April 02, 2014
    0

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

    shimab alam
    March 20, 2014
    0