Chapter 1:The .NET Foundation
In .NET, this new garbage collector works so that you as a developer are no longer required to
monitor your code for unneeded objects and destroy them. The garbage col lector will take care
of all this for you. Garbage collection does not happen immediately, but instead the garbage
collector will occasionally make a sweep of the heap to determine which objects should be
allocated for destruction. This new system completely absolves the devel oper from hunting
down memory usage and deciding when to free memory.
With this new garbage collector, you can control certain aspects of its functions, as it works
behind the scenes in your application. Within the SDK documentation, look under the
System.GC class for more information.
The .NET Framework is made up of hundreds of classes. Many of the applic ations that you
build in .NET are going to take advantage of these classes in one way or another. Because the
number of classes is so large and you will need to get at them in a logi cal fashion, the .NET
Framework organizes these classes into a class structure called a namespace. There are a
number of namespaces, and they are organized in an understandable and st raightforward way.
NOTE: System is the base namespace in the .NET Framework. All namespaces that are provided in the
framework start at this base namespace. For instance, the classes that deal with data access and
manipulation are found in the System.Data namespace. Other examples include System.IO,
System.XML, System.Collections, System.Drawing, and so forth. In the naming
conventions of namespaces, System.XML.XMLReader represents the XMLReader type, which
belongs to the System.XML namespace.
You can import a namespace into your application in the following manner:
If you are going to import more than one namespace into your application , do so as shown in
the following code:
By importing a namespace into your application, you no longer need to fu lly qualify the class.
For example, if you do not import the namespace into your application, y ou must write out the
full class name.