namespace (C# Reference)
The namespace keyword is used to declare a scope that contains a set of related objects. You can use a namespace to organize code elements and to create globally unique types.
Within a namespace, you can declare one or more of the following types:
Whether or not you explicitly declare a namespace in a C# source file, the compiler adds a default namespace. This unnamed namespace, sometimes referred to as the global namespace, is present in every file. Any identifier in the global namespace is available for use in a named namespace.
Namespaces implicitly have public access and this is not modifiable. For a discussion of the access modifiers you can assign to elements in a namespace, see Access Modifiers (C# Reference).
It is possible to define a namespace in two or more declarations. For example, the following example defines two classes as part of the MyCompany namespace:
The following example shows how to call a static method in a nested namespace.
For more information about using namespaces, see the following topics:
For more information, see the C# Language Specification. The language specification is the definitive source for C# syntax and usage.