Wintellect Blogs

What’s new in CLR via C#, 3rd Edition as compared to the 2nd Edition

1 Nov , 2009  

Last week I submitted the reaming chapters for my new book. It is now being edited and should be available right around the time that Visual Studio 2010 launches (March 22, 2010).

One place you can order it is here:

I know that many people will ask me what are the differences between the 2nd edition and the 3rd edition and so I thought I’d create this blog post to address this.

Overall, every chapter has been modified making the text clearer, fixing any known mistakes and I’ve added more 64-bit coverage as this hardware is becoming more commonplace. I’ ve also embellished a lot of text to reflect new things that I’ve learned in the last 5 years since the previos edition of the book was published. In addtion, since the 2nd Edition of the book covered version 2.0 of the .NET Framework and C#, the new book adds coverage of versions 3.0, 3.5 and 4.0.

Also, I always thought I’d write a Threading Book showing how to properly architect software to build responsive and scalable applications and components in today’s world of multi-core computers. However, I decided to just include this other book’s content in the 3rd Edition of CLR via C# and so Part 5 of the book has five pretty lengthy chapters related to Threading. These chapters (like all chapters in the book) are very prescriptive. That is, I don’t just explain what is in the .NET Framework and how to use it. I explain when to use it and why as well as pitfalls associated with various constructs. I have written a lot of threading material over the past 20+ years and this is all new material presented in an all new way that I think will resonate well with software developers. The 2nd edition of CLR via C# had two chapters related to threading; the five new chapters contain a small part of that material but the new chapters are basically rewritten and add all of the new stuff that is being introduces with .NET 4.0.

Below is the Table of Contents for CLR via C#, 3rd Edition and a brief description of what has been added to each chapter since the 2nd Edition.

Part I – CLR Basics

Chapter 1-The CLR’s Execution Model

Added about discussion about C#’s /optimize and /debug switches and how they relate to each other.

Chapter 2-Building, Packaging, Deploying, and Administering Applications and Types

Improved discussion about Win32 manifest information and version resource information.

Chapter 3-Shared Assemblies and Strongly Named Assemblies

Added discussion of TypeForwardedToAttribute and TypeForwardedFromAttribute.

Part II – Designing Types

Chapter 4-Type Fundamentals

No new topics.

Chapter 5-Primitive, Reference, and Value Types

Enhanced discussion of checked and unchecked code and added discussion of new BigInteger type. Also added discussion of C# 4.0’s dynamic primitive type.

Chapter 6-Type and Member Basics

No new topics.

Chapter 7-Constants and Fields

No new topics.

Chapter 8-Methods

Added discussion of extension methods and partial methods.

Chapter 9-Parameters

Added discussion of optional/named parameters and implicitly-typed local variables.

Chapter 10-Properties

Added discussion of automatically-implemented properties, properties and the Visual Studio debugger, object and collection initializers, anonymous types, the System.Tuple type and the ExpandoObject type.

Chapter 11-Events

Added discussion of events and thread-safety as well as showing a cool extension method to simplify the raising of an event.

Chapter 12-Generics

Added discussion of delegate and interface generic type argument variance.

Chapter 13-Interfaces

No new topics.

Part III – Essential Types

Chapter 14-Chars, Strings, and Working with Text

No new topics.

Chapter 15-Enums

Added coverage of new Enum and Type methods to access enumerated type instances.

Chapter 16-Arrays

Added new section on initializing array elements.

Chapter 17-Delegates

Added discussion of using generic delegates to avoid defining new delegate types. Also added discussion of lambda expressions.

Chapter 18-Attributes

No new topics.

Chapter 19-Nullable Value Types

Added discussion on performance.

Part IV – CLR Facilities

Chapter 20-Exception Handling and State Management

This chapter has been completely rewritten. It is now about exception handling and state management. It includes discussions of code contracts and constrained execution regions (CERs). It also includes a new section on trade-offs between writing productive code and reliable code.

Chapter 21-Automatic Memory Management

Added discussion of C#’s fixed state and how it works to pin objects in the heap. Rewrote the code for weak delegates so you can use them with any class that exposes an event (the class doesn’t have to support weak delegates itself). Added discussion on the new ConditionalWeakTable class, GC Collection modes, Full GC notifications, garbage collection modes and latency modes. I also include a new sample showing how your application can receive notifications whenever Generation 0 or 2 collections occur.

Chapter 22-CLR Hosting and AppDomains

Added discussion of side-by-side support allowing multiple CLRs to be loaded in a single process. Added section on the performance of using MarshalByRefObject-derived types. Substantially rewrote the section on cross-AppDomain communication. Added section on AppDomain Monitoring and first chance exception notifications. Updated the section on the AppDomainManager class.

Chapter 23-Assembly Loading and Reflection

Added section on how to deploy a single file with dependent assemblies embedded inside it. Added section comparing reflection invoke vs bind/invoke vs bind/create delegate/invoke vs C#’s dynamic type.

Chapter 24-Runtime Serialization

This is a whole new chapter that was not in the 2nd Edition.

Part V – Threading

Chapter 25-Threading Basics

Whole new chapter motivating why Windows supports threads, thread overhead, CPU trends, NUMA Architectures, the relationship between CLR threads and Windows threads, the Thread class, reasons to use threads, thread scheduling and priorities, foreground thread vs background threads.

Chapter 26-Performing Compute-Bound Asynchronous Operations

Whole new chapter explaining the CLR’s thread pool. This chapter covers all the new .NET 4.0 constructs including cooperative cancelation, Tasks, the aralle class, parallel language integrated query, timers, how the thread pool manages its threads, cache lines and false sharing.

Chapter 27-Performing I/O-Bound Asynchronous Operations

Whole new chapter explaining how Windows performs synchronous and asynchronous I/O operations. Then, I go into the CLR’s Asynchronous Programming Model, my AsyncEnumerator class, the APM and exceptions, Applications and their threading models, implementing a service asynchronously, the APM and Compute-bound operations, APM considerations, I/O request priorities, converting the APM to a Task, the event-based Asynchronous Pattern, programming model soup.

Chapter 28-Primitive Thread Synchronization Constructs

Whole new chapter discusses class libraries and thread safety, primitive user-mode, kernel-mode constructs, and data alignment.

Chapter 29-Hybrid Thread Synchronization Constructs

Whole new chapter discussion various hybrid constructs such as ManualResetEventSlim, SemaphoreSlim, CountdownEvent, Barrier, ReaderWriterLock(Slim), OneManyResourceLock, Monitor, 3 ways to solve the double-check locking technique, .NET 4.0’s Lazy and LazyInitializer classes, the condition variable pattern, .NET 4.0’s concurrent collection classes, the ReaderWriterGate and SyncGate classes.

  • Anonymous

    Looks great. The first edition was one of the best technical books that I have read. I am looking forward to the third edition.

    Will the new edition contain a CD with an eBook version? Or will Microsoft Press sell a separate eBook version? As much as I enjoyed the first edition, I am now two countries removed from it as I am not able to carry all of my books with me. It is also difficult to find room on my already terribly overflowing bookshelves for more books. As a solution to such problems, I have been trying to convert or replace my existing books to eBooks. Will this be an option for your new book?

  • Anonymous

    Congratulation for finishing the book. Looking forward to get a copy and hope to see you once again in Europe. Harry (meet you in Mainz)

  • JeffreyR

    The plan is that this book WILL have an eBook available for it. I do not know more of the details just now.

    I will be at the DevWeek conference in England, March 15-19, 2010. For more information about the conference, please see

  • Just pre-ordered it from Amazon. Cant wait for it 🙂

  • JeffreyRichter在最新的随笔中透露,CLRviaC#3rdEdition已经提交出版社编辑,并将于明年3月22日VisualStudio2010发布时同步出版。本书包含Je…

  • Are you serious?

    I just bought the second edition last week 🙁

  • Thank you for submitting this cool story – Trackback from

  • Windows Workflow WF4 Beta 1 => Beta 2 Breaking Changes Document Published – Matt Winkler points to the document on downloads that lists the major breaking changes that occurred for WF between Beta 1 and Beta 2 My presentations at HDC

  • JeffreyR

    I just found out that the First Commercial Ship Date for the book is February 10, 2010. The book should be in stores shortly after this date.

  • Anonymous

    i’m still working on the 2nd Edition

  • Anonymous

    I known LINQ is just some syntax suger and has nothing to do with the CLR, but will it be involved? It is quite popular today.

  • Anonymous

    Fantastic!!Thank you Jeff!谢谢!!

  • Web Fast by Default and Web Performances Easy Version Control with Git Firebug Net Panel: more accurate

  • Anonymous


  • Nuovi libri su agile, Scrum e .NET – New books about agile, Scrum and .NET

  • Anonymous

    Great !! I read both your 1st and 2nd Edition. Eagerly waiting for the 3rd Edition. Threading coverage looks impressive.

  • Anonymous

    I’m reading the second edition. I would like to know if there were some “fundamental” change in CLR regarding the new versions of .NET.
    Did the 4.0 version of .NET changed a lot regarding the 2.0?

    Thank you,

  • Anonymous

    Hi ,

    Your last book (CLR via C# – .Net 2.0 ) was like the ideal book I would ever like to read for any technical subject. I just loved how you explained the basic internal working and still managed to say everything important in working of .Net

    Anub Philip

  •   Джеффри Рихтер закончил 3-ю редакцию книги которая фактически стала “C# библией”, английский вариант

  • Anonymous

    Wow, .NET 4.0 plus 5 new chapters on threading, can’t wait to get my hands on it.

    On a side note, it would be nice to have those spam comments removed, they are really an eyesore to such a great blog.

  • Anonymous

    what places will sell CLR via C# 3rd Edition? amazon uk sells it for £45.99, which is absurd.

    also, do you plan on making a kindle version available?

  • Anonymous

    I feel deprived here. You should have written separate book for threading. The space utilized by those threading chapters could have been used for other important new additions like LINQ etc. Otherwise how else to get your expert insightful comments on those uncharted areas?

  • NDepend is a product that analyzes large code bases and provides information about dependencies, complexity

  • Anonymous

    Hi Jeff,

    I was one among those waiting for the release of the new version of CLR via C# 3rd edition. When I was going through CLR 2nd edition, one chapter, that I found missing was “CLR security model and whole security conceps around it.” But I didnt found a chapter for this topic even in the 3rd edition. Did I missed it somewhere ? or is it truly not present ?

  • Anonymous

    I already had the 1st and 2nd editions, I got the 3rd edition, and I think its an excellent book. Thanks.

    However I would have loved having 2 additional chapters focusing on Security (code access security, trust, permissions, etc) and Interop (calling COM, unmanaged code, how data is marshaled to and from unmanaged code, implementing COM components with C#, etc).

    In my humble opinion, those two topics deserve 2 dedicated chapters.

  • Anonymous

    I started from second edition, it gave me indepth knowledge and I was very happy that I am using this book. I was waiting for the 3rd edition..

  • Anonymous

    The last four chapters about threading are excellent indeed!
    However I’m disappointed not to see a seperate chapter dedicated to SECURITY, which I had expected.
    .NET 4.0 is said to drop old ‘code access security’ and ‘enforced security policies’ and adopt a new and simpler security model. I have to learn that .NET team’s blog…

  • Great!!!!! still i am reading your second edition.

  • I would love to read your new addition book!

    Thanks for making me aware about this!

  • When the green wind blowing hot, the brand’s range of single products also will turn the tide of environmental protection, environmental protection classes in particular are environmentally friendly and innovative products is won by consumers. The largest brand of air max 2009 protection: a luxury brand fame and fortune

  • Anonymous


    Is there an email for you? I see no about page or way to ask questions if I stumble at times in this book.

  • Anonymous

    grammar mistake

    “Last week I submitted the reaming chapters for my new book”


  • Anonymous

    Dude, where are your contact and about page in this blog??? strange.

    just some feedback here, it would be useful for you to add this. I was surprised a dude like you (which whom I have your book by the way) would be lacking these essential functions in your own blog!!

  • Thank you Jeffery, I’ve learnt so much from you! Really appreciate!

  • Good post man, just looking around some blogs, seems a pretty nice platform you are using.

  • This is the good step u have taken. Thanks for writing this, its clear you have spent a good amount of time on your sites development.

  • Now that CLR version has been updated to 4.5
    Can we expect something like “CLR via C#4” 🙂

    Btw the book is awesome 🙂