Home > Store

Essential .NET, Volume I: The Common Language Runtime

Register your product to gain access to bonus material or receive a coupon.

Essential .NET, Volume I: The Common Language Runtime


  • Sorry, this book is no longer in print.
Not for Sale



  • Goes into a greater level of detail than any other CLR book.
  • First book in the Microsoft .NET Development Series, authorized by the .NET Development Team at Microsoft.


  • Copyright 2003
  • Dimensions: 7-3/8" x 9-1/4"
  • Pages: 432
  • Edition: 1st
  • Book
  • ISBN-10: 0-201-73411-7
  • ISBN-13: 978-0-201-73411-9

Essential .NET will enable developers to take advantage of the full power available to them in Microsoft .NET. It goes far beyond the features-based "how-to" books currently on the market to also explain the "why" behind C #, .NET, and the CLR. As with all of Don's books, it is packed with practical detail and expert advice. It promises to be the book developers will reach for first with questions about the CLR and .NET. In his new position at Microsoft Don is even better placed to evangelize for this book. He will be speaking everywhere, and will continue placing articles in MSDN, where he has already started excerpting this book. Since this book was first announced last fall, there has been a groundswell of interest in it. There will be a foreword from Jim Miller, the inventor of the CLR. Originally appeared in October 2001 catalog.

Sample Content

Online Sample Chapter

.NET Common Language Runtime Components

Downloadable Sample Chapter

Click below for Sample Chapter(s) related to this title:
Sample Chapter 2

Table of Contents

(NOTE: Each chapter concludes with Where Are We?)

List of Figures.

List of Tables.



1. The CLR as a Better COM.

COM Revisited.

The Common Language Runtime.

The Evolution of the Programming Model.

2. Components.

Modules Defined.

Assemblies Defined.

Assembly Names.

Public Keys and Assemblies.

The CLR Loader.

Resolving Names to Locations.

Versioning Hazards.

3. Type Basics.

Type Fundamentals.

Types and Initialization.

Types and Interfaces.

Types and Base Types.

4. Programming with Type.

Types at Runtime.

Programming with Metadata.

Special Methods.

Metadata and Extensibility.

5. Instances.

Objects and Values Compared.

Variables, Parameters, and Fields.

Equivalence Versus Identity.




Object Life Cycle.


6. Methods.

Methods and JIT Compilation.

Method Invocation and Type.

Interfaces, Virtual Methods, and Abstract Methods.

Explicit Method Invocation.

Indirect Method Invocation and Delegates.

Asynchronous Method Invocation.

Method Termination.

7. Advanced Methods.


Messages as Method Calls.

Stack and Message Transitions.

Proxiable Types.

Message Processing (Revisited).

Objects and Context.

Contexts and Interception.

8. Domains.

Execution Scope and the CLR.

Programming with AppDomains.

AppDomain Events.

AppDomains and the Assembly Resolver.

AppDomains and Code Management.

AppDomains and Objects (Revisited).

9. Security.

Components and Security.





10. CLR Externals.


Modes of Execution.

Unmanaged Modules.

Loading the CLR.

The CLR as a COM Component.


Index. 0201734117T09272002


What happened?

In 1998, Microsoft held a Professional Developer's Conference (PDC) in San Diego. COM luminary Charlie Kindel stood up in a general session and proclaimed "no more GUIDS—no more HRESULTS—no more IUnknown." He and Mary Kirtland proceeded to show the basic architecture of the CLR, then known as the COM+ Runtime. Later in the session, Nat Brown and David Stutz stood up and demonstrated cross-language inheritance using Visual Basic and Java. Attendees actually went home with CDs containing primitive versions of compilers that could reproduce this very odd demonstration.

It is now February 2002 and this technology has finally shipped in release form.There are two days that will forever demarcate the evolution of the Microsoft platform. In May of 1993, Windows NT 3.1 was released, which marked the end of the DOS era. On February 13, 2002, the Common Language Runtime (CLR) was released as part of the .NET Framework, marking the end of the COM era.

The .NET Framework is a platform for software integration. Fundamentally, the .NET Framework provides two core integration technologies. The Common Language Runtime (CLR) is used to integrate software within a single operating system process.

XML Web Services are used to integrate software at Internet-scale. Both rely on similar ideas, that is, strongly typed contracts and encapsulation. Fundamentally, though, they are two distinct technologies that one can elect to adopt independently of one another. It is completely reasonable to adopt XML Web Services prior to the CLR (in fact, many production web services have already done this). It is also reasonable to adopt the CLR in the absence of XML Web Services in order to access CLR-specific features such as code access security or superior memory management facilities. Going forward, however, both the CLR and XML Web Services will be central to the Microsoft development platform, and it is only a matter of time before both of these technologies play a role in everyone's development experience.

The CLR and XML Web Services are both focused on strongly-typed contracts between components. Both technologies require developers to describe component interactions in terms of type definitions or contracts. In both technologies, these contracts share two key ideas that tend to permeate their use: metadata and virtualization.

Both the CLR and XML Web Services rely on high-fidelity, ubiquitous, and extensible metadata to convey programmer intention. Metadata conveys the basic structure and type relationships to developers who will consume a CLR component or XML Web Service. Equally important, ubiquitous metadata informs the tools and underlying platform of what the component developer had in mind when they were authoring the code.

This metadata-directed "clarvoyance" allows the platform to provide richer support than would be possible if the component was completely opaque. For example, various aspects of object-to-XML mapping are captured in metadata for use by the CLR's XML serializer. How the developer intended the XML to look is conveyed through declarative metadata extensions rather than through explicit labor-intensive coding.

The second key idea that permeates CLR and XML Web Service contracts is the notion of virtualization. Both technologies emphasize the separation of semantic intentions from physical implementation details. Specifically, the metadata for both technologies work at an abstract structural level rather than in terms of low-level data representations and implementation techniques. By specifying inter-component contracts at this "virtual" level, the underlying platform is free to express the contracts in the most appropriate manner available. For example, by expressingWeb Service contracts in terms of an abstract data model, the plumbing is free to use an efficient binary data representation for performance or the text-based XML 1.0 representation for maximum interoperability.

Because contracts are virtualized, this specific detail of the contract can be bound at runtime based on post-development characteristics.

Because this volume focuses exclusively on the CLR, a working definition of the CLR is in order. The CLR is fundamentally a loader that brings your components to life inside an operating system process. The CLR replaces COM's <code>CoCreateInstance</code> and Win32's <code>LoadLibrary</code> as the primary loader for code.

The CLR loader provides a number of services beyond what COM and Win32 before it offered. The CLR loader is version-aware and provides flexible configuration of version policies and code repositories. The CLR loader is security-aware and is a critical part of the enforcement of security policy. The CLR loader is type-aware and provides a rich runtime enviroment for the explicit management and creation of types independent of programming language. In short, the CLR loader is an advanced component technology that supplants COM as Microsoft's primary in-memory integration strategy.

The CLR is made accessible through compilers that emit the CLR's new file format. Program language wonks view the CLR as providing key building blocks for compiler writers that reduce the complexity of compiler implementations. In contrast, systems wonks often view programming languages as facades or "skins" over the underlying constructs of the CLR. The author falls firmly into the latter camp. However, programming languages are a neccessary lens through which even low-level systems plumbers view the CLR. To that end, examples in this book are written in various programming languages, since binary dumps of metadata and code are arcane to the point of being incomprehensible.

About this book

This book is divided into two volumes. Volume 1 focuses on the Common Language Runtime. Volume 2 will focus on XML Web Services. While the two technologies share a fair number of core concepts, the thought of covering them both in a single book made my head spin.

This book was written against Version 1 of the CLR. Some of the internal techniques used by the CLR may evolve over time and may in fact change radically. In particular, the details of virtual method dispatch are very subject to change. They are included in this book largely as an homage to COM developers looking for where the vptr went. That stated, the basic concepts that are the focus of this book are likely to remain stable for years to come.

Throughout the book, I use assertions in code to reinforce the expected state of a program. In the CLR, assertions are performed using <code>System.Diagnostics.Debug.Assert</code>, which accepts a boolean expression as its argument. If the expression evaluates to false, then the assertion has failed and the program will halt with a distinguished error message. For readability, all code in this book uses the short form <code>Debug.Assert</code>, which assumes that the <code>System.Diagnostics</code> namespace prefix has been imported.

My perspective on .NET is fairly agnostic with respect to language. In my daily life, I use C# for about 50% of my CLR-based programming. I use C++ for about 40%, and resort to ILASM for the remaining 10%. That stated, most programming examples use C# if for no other reason than it is often the most concise syntax for representing a particular concept or technique. Though some chapters may seem language focused, none of them really are. The vast majority of this book could have used C++, but, given the tremendous popularity of C#, I elected to use C# to make this book as accessible as possible.

This book focuses on the Common Language Runtime and is divided into ten chapters:

Chapter 1 The CLR as a better COM

This chapter frames the discussion of the CLR as a replacement for the Component Object Model (COM) by looking at the issues that faced COM developers and how the CLR addresses those issues through virtualization and ubiquitous, extensible metadata.

Chapter 2 Components

Ultimately, the CLR is a replacement for the OS and COM loaders. This chapter looks at how code is packaged and how code is loaded, both of which are significantly different from the Win32 and COM worlds.

Chapter 3 Type Basics

Components are containers for the code and metadata that make up type definitions. This chapter focuses on the CLR's Common Type System (CTS), including what constitutes a type and how types relate. This is the first chapter that contains significant chunks of source code.

Chapter 4 Programming with Type

The CLR makes type a first-class concept in the programming model. This chapter is dedicated to the explicit use of type in CLR programs with an emphasis on the role of metadata and runtime type information.

Chapter 5 Instances

The CLR programming model is based on types, objects, and values. The previous chapter focused on type; this chapter focuses on objects and values. Specifically, this chapter outlines the difference between these two instancing models including how values and objects differ with respect to memory management.

Chapter 6 Methods

All component interaction occurs through method invocation. The CLR provides a broad spectrum of techniques for making method invocation an explicit act. This chapter looks at those techniques, starting with method initialization through JIT compilation and ending with method termination via strongly-typed exceptions.

Chapter 7 Advanced Methods

The CLR provides a rich architecture for intercepting method calls. This chapter dissects the CLR's interception facilities and its support for aspect-oriented programming. These facilities are one of the more innovative aspects of the CLR.

Chapter 8 Domains

The CLR uses AppDomains rather than OS processes to scope the execution of code. To that end, this chapter looks at the role of AppDomains both as a replacement for the underlying OS's process model as well as an AppDomain's interactions between the assembly resolver/loader. Readers with Java roots will find the closest analogue to a Java class loader here.

Chapter 9 Security

One of the primary benefits of the CLR is that it provides a secure execution environment. This chapter looks at how the CLR loader supports granting privileges to code and how those privileges are enforced.

Chapter 10 CLR Externals

The first nine chapters of this book are focused on what it means to write programs to the CLR's programming model. This concluding chapter looks at how one steps outside of that programming model to deal with the world outside of the CLR.




I worked for the World Wide Web Consortium in its early days at the Massachusetts Institute of Technology (MIT). We decided we needed to learn about both COM and CORBA, at that time the leading frameworks for object-oriented programming over the network.

I called our Microsoft representative and asked who he could send to teach the Consortium staff the fundamentals of COM. I explained that the Consortium staff were very technical and were interested in the "why" of things at least as much as the "how." I explained that we were designing the next generation Web protocols and knew just about everything there was to know about application protocols on the Internet, and that we'd built some very large object-oriented programs in C++ and Objective C.

I fully expected him to suggest someone from Microsoft. Instead he said, "The best person in the world is Don Box." And that's how I met Don, one of the finest teachers I know. Don not only explained well and ran labs well and wrote well, but he never broke down under endless detailed questioning, ranging from the high-level "Why would you build the architecture that way?" to the low-level "Where does that bit ever get set?" So Don taught me (along with hundreds of thousands of others) what COM is, why COM is, and what the problems with COM are. Along the way, just off-hand 'cause he thought we might be interested, he also did an amazingly good comparison to the CORBA technology and to the Web technology we were designing and building.

I left the MIT and the Web Consortium to come to Microsoft to work on a top-secret project called "COM+ Services." My business card read "Program Manager, Garbage Collection and Related Rubbish" because all we could say (even internally at Microsoft) was that it had something to do with programming languages and distributed systems, and it had a garbage collector. I'm still on that same project at Microsoft, working almost four years to help design and build what is now the Common Language Runtime. I've worked on the IL design, four different JITs, the metadata, the garbage collector, the execution engine, and the ECMA (and soon, hopefully, ISO) standards.

I was sure that I'd be able to turn around and teach Don something I'd learned in this process (I'm not a bad teacher myself). But Don beat me to the punch. He told me to read this book. And (darn it) he's taught me stuff I didn't know about my own product! And I bet he'll teach you something, too.

Dr. James S. Miller
Microsoft Corporation
Lead Program Manager
Common Language Runtime


Click below to download the Index file related to this title:


Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020