Chapter 4. Base Class Library Overview

In Chapter 3, we focused on some of the key aspects of the .NET Framework and how to leverage them from C#. However, access to these capabilities isn’t limited to C#.

Almost all the capabilities of the .NET Framework are exposed via a set of managed types known as the Base Class Library (BCL). Because these types are CLS-compliant, they are accessible from almost any .NET language. BCL types are grouped logically by namespace and are exported from a set of assemblies (DLLs) that are part of the .NET platform. Using these types in a C# application requires you to reference the appropriate assembly when compiling (see Appendix F).

In order to work effectively in C# on the .NET platform, it is important to understand the general capabilities in the predefined class library. However, the library is far too large to cover completely in this book, as it encompasses approximately 4,500 types grouped into 120 namespaces and exported from 40 different assemblies.

Instead, in this chapter, we give an overview of the entire BCL (broken down by logical area) and provide references to relevant types and namespaces so that you can explore their details in the .NET Framework SDK on your own.

The specific types and namespaces mentioned in this overview are based on beta 1 of the .NET Framework and may change in future betas and the released version.

Some namespaces and types listed here aren’t documented, and are therefore unsupported by Microsoft. For clarity, these namespaces are listed in constant width italics.

Useful tools for exploring the BCL include the .NET Framework SDK documentation, the WinCV.exe class browser, and the ILAsm.exe disassembler (see Chapter 5)

Core Types

The core types are contained in the System namespace. This namespace is the heart of the BCL and contains classes, interfaces, and attributes that all other types depend on. The root of the BCL is the type Object , from which all other .NET types derive. Other fundamental types are ValueType (base type for structs), Enum (base type for enums), Convert (used to convert between base types), Exception (base type for all exceptions), and the boxed versions of the predefined value types. Interfaces that are used throughout the BCL such as ICloneable , IComparable , IFormattable , and IConvertible are defined here (see Section 3.3 in Chapter 3). Extended types such as DateTime , TimeSpan , and DBNull are also available. Other classes include support for single and multicast delegates (see Section 2.13 in Chapter 2), basic math operations (see Section 3.2 in Chapter 3), attributes (see Section 2.16 in Chapter 2), and exception handling (see Section 2.15 in Chapter 2).

For more string information, see the String namespace.

Get C# Essentials 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.