Datasheet
The great thing about the .NET base classes is that they have been designed to be very intuitive and easy
to use. For example, to start a thread, you call the
Start() method of the Thread class. To disable a
TextBox, you set the Enabled property of a TextBox object to false. This approach — while familiar to
Visual Basic and Java developers, whose respective libraries are just as easy to use— will be a welcome
relief to C++ developers, who for years have had to cope with such API functions as
GetDIBits(),
RegisterWndClassEx(), and IsEqualIID(), as well as a whole plethora of functions that required
Windows handles to be passed around.
On the other hand, C++ developers always had easy access to the entire Windows API, whereas Visual
Basic 6 and Java developers were more restricted in terms of the basic operating system functionality that
they have access to from their respective languages. What is new about the .NET base classes is that they
combine the ease of use that was typical of the Visual Basic and Java libraries with the relatively compre-
hensive coverage of the Windows API functions. Many features of Windows still are not available through
the base classes, and for those you will need to call into the API functions, but in general, these are now
confined to the more exotic features. For everyday use, you will probably find the base classes adequate.
And if you do need to call into an API function, .NET offers a so-called platform-invoke that ensures data
types are correctly converted, so the task is no harder than calling the function directly from C++ code
would have been — regardless of whether you are coding in C#, C++, or Visual Basic 2005.
WinCV, a Windows-based utility, can be used to browse the classes, structs, interfaces, and enums in
the base class library. WinCV is discussed in Chapter 14, “Visual Studio 2005.”
Although Chapter 3 is nominally dedicated to the subject of base classes, in reality, once we have com-
pleted our coverage of the syntax of the C# language, most of the rest of this book shows you how to
use various classes within the .NET base class library. That is how comprehensive base classes are. As a
rough guide, the areas covered by the .NET base classes include:
❑ Core features provided by IL (including the primitive data types in the CTS discussed in
Chapter 3, “Objects and Types”)
❑ Windows GUI support and controls (see Chapter 23, “Windows Forms”)
❑ Web Forms (ASP.NET, discussed in Chapters 26, “ASP.NET Pages” and 27, “ASP.NET
Development”)
❑ Data Access (ADO.NET; see Chapters 19, “Data Access with .NET,” 20, “.NET Programming
with SQL Server 2005,” and 21, “Manipulating XML”)
❑ Directory Access (see Chapter 22, “Working with Active Directory”)
❑ File system and registry access (see Chapter 34, “Manipulating Files and the Registry”)
❑ Networking and Web browsing (see Chapter 35, “Accessing the Internet”)
❑ .NET attributes and reflection (see Chapter 11, “Reflection”)
❑ Access to aspects of the Windows OS (environment variables and so on; see Chapter 16, “.NET
Security”)
❑ COM interoperability (see Chapters 30, “Enterprise Services” and 33, “COM Interoperability”)
Incidentally, according to Microsoft sources, a large proportion of the .NET base classes have actually
been written in C#!
20
Chapter 1
05_575341 ch01.qxd 10/4/05 7:03 PM Page 20