Chapter 4. The .NET Framework: General Concepts

In this chapter, we discuss some of the main concepts in the .NET Framework. This is intended as a general overview, just to give you the “lay of the .NET land,” so to speak. For more information, see Thuan Thai and Hoang Q. Lam’s .NET Framework Essentials (O’Reilly, 2001).

Namespaces

The notion of a namespace plays a fundamental role in the .NET Framework. In general, a namespace is a logical grouping of types for the purpose of identification. For example, imagine that in a certain business there is an executive named John Smith, a secretary named John Smith, and a custodian named John Smith.

In this case, the name John Smith is ambiguous. When the paymaster stands on a table and calls out the names of people to receive their pay checks, the executive John Smith won’t be happy if he rushes to the table when the paymaster calls out his name and the envelope contains the custodian John Smith’s pay check.

To resolve the naming ambiguity, the business can simply define three namespaces: Executive, Secretarial, and Custodial. Now the three individuals can be unambiguously referred to by their fully qualified names:

  • Executive.John Smith

  • Secretarial.John Smith

  • Custodial.John Smith

The .NET Framework Class Library (FCL), which we look at in more detail in Chapter 5, consists of several thousand classes and other types (such as interfaces, structures, and enumerations) that are divided into over 90 namespaces. These namespaces provide basic system services, such as:

  • Basic and advanced data types and exception handling (the System namespace)

  • Data access (the System.Data namespace)

  • User-interface elements for standard Windows applications (the System.Windows.Forms namespace)

  • User-interface elements for web applications (the System.Web.UI namespace)

In fact, the VB .NET language itself is implemented as a set of classes belonging to the Microsoft.VisualBasic namespace. (The C# and JScript languages are also implemented as a set of classes in corresponding namespaces.)

For information on accessing the members of a namespace, see Section 4.5 later in this chapter.

Namespaces are not necessarily unique to the Framework Class Library; you can also create your own namespaces by using the Namespace statement at the beginning of a code file.

Get VB .NET Language in a Nutshell 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.