Chapter 11. Namespaces

Namespaces allow related classes to be grouped together. You can use them in your program to add some structure to your projects. The .NET Framework uses namespaces to organize the thousands of classes in the class library to make them easier to use. In this chapter, we'll explore how to use namespaces to access the library classes, how to create custom namespaces to organize your own classes, and how to address the problems of ambiguity and collision in type names. Table 11-1 provides the problem/solution summary for this chapter.

Table 11-1. Quick Problem/Solution Reference for Chapter 11

Problem

Solution

Listings

Access a type contained in a namespace.

Use the fully qualified name of the type.

11-1, 11-2

Import a namespace.

Get Introducing Visual C# 2010 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.