In many respects, the
System namespace serves as the
core namespace for the .NET libraries, in much the same
java.lang does for Java programmers or
stdlib.h does for C/C++ programmers. For example, the
ECMA-compliant primitive-type value types are defined in the
System namespace, along with
complementary composite types and base types. These are used in the synthesis of
type generation, which is done by the compiler on the .NET programmer’s behalf
(for an example of this on-the-fly type synthesis, see
Figure 4-1 shows many of the types in this namespace.
System serves as the home for key base-type definitions,
Object, the root of every type in the
.NET hierarchy. Every type in the system ultimately extends this class,
making it the “root of all evil” in .NET. In addition, this
ValueType, the base type for
all value types in .NET (such as the primitive types listed later in this chapter,
shown in Figure 4-5), and
Type, which in turn represents
compile-time type information about other types defined within the .NET
environment (the type metadata).
ECMA-compliant primitive-type value types include the
fundamental types used for all .NET applications, which are basic value types such as
All of the primitive types are aliased in VB.NET with keywords such
See the description of each type for more
In addition to these fundamental types, there are
composite types such as
TimeSpan, used to handle date- and time-based
calculations without having to drop down to integer math, and
Uri, used to represent references to a
Universal Resource Identifier, which is the more generic form of the ubiquitous
HTTP URL identifier used on the Web.
In addition to these primitive and composite types, several
interfaces defined here are intended as support interfaces.
For example, the interfaces
types support the same basic operations (conversion,
comparison, and cloning, respectively) that the primitive types offer.
The base type for any array-type declaration, allowing .NET developers to refer to any type (or rank) array without having to specify exact type.
Base types for delegate types
(see Figure 4-2)
created using the
Delegate keyword in VB.NET.
The base type required for any type that wishes to be used as an attribute on other types, or methods, fields, etc. (see Figure 4-2).
Because delegates are often used in conjunction with events and event
System also contains the definitions for
EventHandler, the universal delegate type, and
EventArgs, the base type representing data sent
as part of an event-handler call.
System also serves as the heart of the exception-handling
hierarchy in .NET, defining the base type
which is the base type for all exceptions. The exception hierarchy is then bifurcated
into two realms: system exceptions, which are exceptions generated by or relating
to the runtime itself, and application exceptions, which are exceptions relating to
the target business domain and typically are used on a per-application
SystemException serves as the base type for
the former, and
ApplicationException is the base type for the latter.
Figure 4-3 and Figure 4-4 show the
exceptions in the System namespace.
System also contains two definitions of
some importance to the .NET programmer: the
interface, used to help programmers define cleanup and resource-release
semantics for their types, and the
GC class, which
gives the .NET programmer access to the CLR garbage collector.
System namespace also contains a few interoperability
Guid represents the OSF UUID
type that was made famous by COM. The attributes
indicate to the runtime which sort of COM apartment-threading model
the .NET component should use (but only when COM interoperability comes
System defines the fundamental types such as
These give the .NET programmer access to the standard-in/standard-out
streams (i.e., the command-shell console) and the environment variables
of a given process, respectively.
Most .NET applications will use ASP.NET or Windows Forms to present a
graphical user interface. However, applications such as compilation
tools, XML filters, and batch jobs use console I/O and environment