Common Type System—Namespaces Organizing Types
Namespaces: Organizing Types
All useful programming environments have a module and packaging system. Aside from assemblies and modules, which provide physical packaging for distribution and reuse namespaces provide a logical packaging facility. As part of a type’s naming, it can also be assigned a namespace. The type’s namespace plus its name is called its fully qualified name. All types
included in the .NET Framework have namespaces, most of them starting with System, although some
product-specific ones start with Microsoft. The CTS has no concept of namespaces. All types and references
to them are emitted using their fully qualified name.
Namespaces are hierarchical in nature. We refer to them by their order, so, for example, the root is the
first level, the set below that are second level, and so on. For example, consider that the fully qualified
name System.Collections.Generic.List<T>. System is the first level, Collections is the second
level, Generic is the third level, and List<T> is the type name. Namespaces really have nothing to do
technology-wise with the assemblies in which they live. Types in the same namespace can span multiple
assemblies. Most developers tend to have a near 1:1 relationship between namespaces and assemblies,
however, to make locating types easier. For example, rather than a user having to consider a set of
assemblies when looking for a certain type in a certain namespace, having a 1:1 correspondence limits
the choice to one.
|

