Home > Articles

This chapter is from the book

This chapter is from the book

7.7 The .NET Framework Class Library

Many predefined classes are grouped into categories of related classes called namespaces. Together, these namespaces are referred to as the .NET Framework Class Library.

using Directives and Namespaces

Throughout the text, using directives allow us to use library classes from the Framework Class Library without specifying their namespace names. For example, an app would include the declaration

using System;

in order to use the class names from the System namespace without fully qualifying their names. This allows you to use the unqualified name Console, rather than the fully qualified name System.Console, in your code.

You might have noticed in each project containing multiple classes that in each class’s source-code file we did not need additional using directives to use the other classes in the project. There’s a special relationship between classes in a project—by default, such classes are in the same namespace and can be used by other classes in the project. Thus, a using declaration is not required when one class in a project uses another in the same project—such as when class AccountTest used class Account in Chapter 4’s examples. Also, any classes that are not explicitly placed in a namespace are implicitly placed in the so-called global namespace.

.NET Namespaces

A strength of C# is the large number of classes in the namespaces of the .NET Framework Class Library. Some key Framework Class Library namespaces are described in Fig. 7.4, which represents only a small portion of the reusable classes in the .NET Framework Class Library.

Namespace

Description

System.Windows.Forms

Contains the classes required to create and manipulate GUIs. (Various classes in this namespace are discussed in Chapter 14, Graphical User Interfaces with Windows Forms: Part 1, and Chapter 15, Graphical User Interfaces with Windows Forms: Part 2.)

System.Windows.Controls

System.Windows.Input

System.Windows.Media

System.Windows.Shapes

System.Linq

Contain the classes of the Windows Presentation Foundation for GUIs, 2-D and 3-D graphics, multimedia and animation.

Contains the classes that support Language Integrated Query (LINQ). (See Chapter 9, Introduction to LINQ and the List Collection, and several other chapters throughout the book.)

System.Data.Entity

Contains the classes for manipulating data in databases (i.e., organized collections of data), including support for LINQ to Entities. (See Chapter 20, Databases and LINQ.)

System.IO

Contains the classes that enable programs to input and output data. (See Chapter 17, Files and Streams.)

System.Web

Contains the classes used for creating and maintaining web apps, which are accessible over the Internet.

System.Xml

Contains the classes for creating and manipulating XML data. Data can be read from or written to XML files.

System.Xml.Linq

Contains the classes that support Language Integrated Query (LINQ) for XML documents. (See Chapter 21, Asynchronous Programming with async and await.)

System.Collections

System.Collections.Generic

Contain the classes that define data structures for maintaining collections of data. (See Chapter 19, Generic Collections; Functional Programming with LINQ/PLINQ.)

System.Text

Contains classes that enable programs to manipulate characters and strings. (See Chapter 16, Strings and Characters: A Deeper Look.)

Fig. 7.4 | .NET Framework Class Library namespaces (a subset).

Locating Additional Information About a .NET Class’s Methods

You can locate additional information about a .NET class’s methods in the .NET Framework Class Library reference

When you visit this site, you’ll see an alphabetical listing of all the namespaces in the Framework Class Library. Locate the namespace and click its link to see an alphabetical listing of all its classes, with a brief description of each. Click a class’s link to see a more complete description of the class. Click the Methods link in the left-hand column to see a listing of the class’s methods.

  • + Share This
  • 🔖 Save To Your Account