C# Corner


About Namespace

For use in Wikipedia, see Wikipedia:Namespace.

In computing, a namespace is a set of symbols that are used to organize objects of various kinds, so that these objects may be referred to by name. Prominent examples include:

  • file systems are namespaces that assign names to files;
  • programming languages organize their variables and subroutines in namespaces;
  • computer networks and distributed systems assign names to resources, such as computers, printers, websites, (remote) files, etc.

Namespaces are commonly structured as hierarchies to allow reuse of names in different contexts. As an analogy, consider a system of naming of people where each person has a proper name, as well as a family name shared with their relatives. If, in each family, the names of family members are unique, then each person can be uniquely identified by the combination of first name and family name; there is only one Jane Doe, though there may be many Janes. Within the namespace of the Doe family, just "Jane" suffices to unambiguously designate this person, while within the "global" namespace of all people, the full name must be used.

In a similar way, hierarchical file systems organize files in directories. Each directory is a separate namespace, so that the directories "letters" and "invoices" may both contain a file "to_jane".

In computer programming, namespaces are typically employed for the purpose of grouping symbols and identifiers around a particular functionality and to avoid name collisions between multiple identifiers that share the same name.

In networking, the Domain Name System organizes websites (and other resources) into namespaces. For example, "org" is a namespace for non-profit organizations, "wikipedia.org" is a sub-namespace assigned to the Wikimedia Foundation, and "en.wikipedia.org" is the name of the English-language Wikipedia within this space.

  1. ^ Adya, Atul; Bolosky, William; Castro, Miguel; Cermak, Gerald; Chaiken, Ronnie; Douceur, John; Howell, Jon; Lorch, Jacob; Theimer, Marvin; Wattenhofer, Roger (2002). FARSITE: Federated, Available, and Reliable Storage for an Incompletely Trusted Environment (PDF). Proc. USENIX Symp. on Operating Systems Design and Implementation. The primary construct established by a file system is a hierarchical directory namespace, which is the logical repository for files. 
  2. ^ "C# FAQ: What is a namespace". http://en.csharp-online.net/: C# Online Net. Archived from the original on 2013-10-20. Retrieved 2010-02-23. A namespace is nothing but a group of assemblies, classes, or types. A namespace acts as a container—like a disk folder—for classes organized into groups usually based on functionality. C# namespace syntax allows namespaces to be nested. 


Spire.Doc - Free .NET Word API
Use Spire.Doc to create, read, write, print, and convert word documents to OpenXML, RTF, TXT, XPS, EPUB, EMF, HTML, Image and PDF.
Download Free eBooks