5

I want to know which is the default namespace of class defined by the programmer,if not specify any?

Let, take the case of Java. In Java, if Programmer is not specify any package then default package is the java.lang

Same way i want to know about default namespace of C# classes.

1 Answer 1

10

global is the default namespace.

Example:

class GlobalClass {
}

namespace MyNamespace {
    class NameSpaceClass {
        public NameSpaceClass() {
            var globalObj = new global::GlobalClass();
        }
    }
}

MSDN Link: http://msdn.microsoft.com/en-us/library/cc713620.aspx

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.