As I mentioned earlier, the .NET Framework is composed of classes—many classes. Namespaces are the method used to create a hierarchical structure of all these classes and they help prevent naming collisions. A naming collision occurs when two classes have the same name. Because namespaces provide a hierarchy, it's possible to have two classes with the same name, as long as they exist in different namespaces. Namespaces, in effect, create a scope for classes.
The base namespace in the .NET Framework is the System namespace. The System namespace contains classes for garbage collection (discussed shortly), exception handling, data typing, and so much more. The System namespace is just the tip of the iceberg. There are literally dozens of namespaces. Table 24.1 lists some of the more common namespaces, many of which you've used in this book. All the controls that you've placed on forms and even the forms themselves, for example, belong to the System.Windows.Forms namespace. Use Table 24.1 as a guide; if a certain namespace interests you, I suggest that you research it further in the Visual Studio .NET online help.
Table 24.1. Commonly Used Namespaces
Namespace
Description
Microsoft.CSharp
Contains classes that support compilation and code generation using the C# language.
Microsoft.VisualBasic
Contains classes that support compilation and code generation using the Visual Basic language.
System
Contains fundamental classes and base classes that define commonly used value and reference data types, event handlers, interfaces, attributes, and exceptions. This is the base namespace of .NET.
System.Data
Contains classes that constitute the ADO.NET architecture.
System.Diagnostics
Contains classes that enable you to debug your application and to trace the execution of your code.
System.Drawing
Contains classes that provide access to the Graphical Device Interface (GDI) basic graphics functionality.
System.IO
Contains classes that allow reading from and writing to data streams and files.
System.Net
Contains classes that provide a simple programming interface to many of the protocols found on the network.
System.Security
Contains classes that provide the underlying structure of the CLR security system.
System.Web
Contains classes that provide interfaces that enable browser/server communication.
System.Windows.Forms
Contains classes for creating Windows-based applications that take advantage of the rich user-interface features available in the Microsoft Windows operating system.
System.Xml
Contains classes that provide standards-based support for processing XML.
All Microsoft-provided namespaces begin with either System or Microsoft. Other vendors can provide their own namespaces, and it's possible for you to create your own custom namespaces as well, but that's beyond the scope of this book.