Organizing Types in Namespaces

Simply stated, namespaces provide a way to establish a hierarchical naming scheme for types in .NET libraries and applications. At the language level, it’s possible to declare new namespaces containing various types. Besides providing namespaces, there’s also the act of using them, which is based on the concept of importing them in code.

One level below the language, the runtime doesn’t really know much about namespaces because types always are referred to by a fully qualified name. Where a full type name looks like System.Collections.Generic.List<int>, you can simply write List<int> if the containing namespace has been imported. In other words, using namespaces yields an abbreviation of type names.

Get C# 5.0 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.