Home > Articles > Programming > Windows Programming

Introduction to the .NET Framework Class Library

  • Print
  • + Share This
In this sample chapter, Lars Powers and Mike Snell introduce the class library that ships with the .NET Framework. Examine its organization, and look at exactly how the classes operate as a reusable layer of functional building blocks for .NET developers.
This sample chapter is excerpted from chapter 4 of Visual Basic Programmer's Guide to the .NET Framework Class Library, by Lars Powers and Mike Snell.
This chapter is from the book


  • Introducing the Framework Class Library
  • Enhancing Developer Productivity
  • The Elements of a Namespace
  • Programming with the Framework Class Library

The Framework Class Library is a vast tapestry; it will take a while before you are familiar enough with it to immediately identify its possible uses in a given situation. This chapter will introduce you to the class library that ships with the .NET Framework. We will examine its organization, and look at exactly how the classes operate as a reusable layer of functional building blocks for .NET developers. You should walk away from this chapter understanding, in principle, what position in the larger .NET initiative that the Framework Class Library holds, and how it is really designed with the end developer in mind. You should also be primed and ready to look at actual code examples in the chapters that follow in Part II, "Working with the .NET Namespaces," of this book.

This chapter will specifically

  • Describe the organization of the class library namespaces.

  • Illustrate how the class library implements the core concepts of classes, enumerations, delegates, interfaces, and structures.

  • Identify the key productivity enhancements offered by programming against the class library.

So, before getting in to the actual makeup of the .NET base classes, we will examine a few basic aspects of the namespaces that constitute the class library.

Introducing the Framework Class Library

As you have probably figured out from its name, the class library is merely a collection of classes and related structures that can be leveraged as base building blocks for application development. As such, it is safe to think of this collection of classes as an API: They are a boundary interface between our applications and the operating system. This concept, of course, is really nothing new to Visual Basic developers: the ADO library, the Win32 API, the COM+ services library—all of these constructs have allowed us to reference and use pre-existing code in our applications. The class library is a massive library of pre-existing code that you can use as a foundation for your application features.


Referencing pre-existing libraries of code has traditionally been pretty easy with Visual Basic. One of the main issues, however, was that many times these code libraries weren't initially consumable by Visual Basic developers. If you were a C++ programmer, the world was open to you in terms of functionality. VB programmers had to wait for Microsoft or some other entity to make a wrapper or interface available that we could use from VB. Documentation also tended to be a problem.

Organization—The Namespace Hierarchy

The primary units of organization for the class library are namespaces. A namespace is just a bucket for functionality: It describes a grouping of like-focused classes and constructs. You can liken the concept of a namespace to that of a file system folder—they both attempt to implement organization across objects with parent and child relationships. Just as a folder can contain other folders and actual documents, a namespace can contain other namespaces or actual classes, delegates, and so on.

All namespaces stem from a common root: the System namespace. The System namespace is the one and only common root for all other namespaces.

The System namespace, for instance, contains the actual structures that define the common data types used in .NET such as Boolean, DateTime, and Int32. It also contains the most important data type of all, Object, which is the base object inherited by all other .NET objects.

Walking the Tree

The first level of children namespaces under the System namespace represents the high-level functionality groupings exposed by the API. Table 4.1 shows these high-level namespaces, with a brief description of their focus. Remember that each one of these high-level namespaces can (and likely will) have other children namespaces that further decompose and organize the functionality and focus of the parent namespace. A good example of this is the System.XML

namespace, which parents the System.XML.Schema, the System.XML.Serialization, the System.XML.XPath, and the System.XML.XSL namespaces.

TABLE 4.1 Primary Namespaces Under the System Root




Source code document structure and manipulation (including compilation).


Collections of objects including arrays, hash tables, and dictionaries.


Runtime and design-time behavior of components and controls.


Configuration settings management for the Framework.


Data access and management (essentially defines the ADO.NET technology).


Application debugging and execution tracing. Also included in this namespace are classes related to event log manipulation and performance monitoring.


Access to the Active Directory.


Graphics and drawing, including printing.


COM interactions and settings.


Definition of culture-specific settings.


Synchronous and asynchronous access to files and streams.


Access to WMI functionality.


Message creation and transmission in addition to management of message queues.


Network communications and protocols.


Examination and on-the-fly creation of types, methods, and fields.


Management of culture-specific resources.


Access to low-level runtime functions, including compilation and interop services.


General runtime security including policies, permissions, and credential resolution.


Creation and installation of Windows services.


Conversion and formatting of text.


Explicit thread creation and management.


Server-based timers.


Browser/server communication over HTTP.


Form-based Windows creation.


XML processing.

You should know that the Framework Class Library can be extended, but that the system root namespace will always contain classes that are universally useful to applications. Companies may introduce their own libraries that will co-exist with the System namespace and that will, in fact, operate under their own root namespace. Microsoft, for instance, has already shown us an example of this by including several language-focused namespaces under a root Microsoft namespace. Thus, we have Microsoft.Csharp, Microsoft.VisualBasic, and so on.

  • + Share This
  • 🔖 Save To Your Account