CLR via C# by Jeffrey Richter
$34.48 at Amazon
While I did notice when Microsoft introduced .NET and the CLR (Common Language Runtime), it wasn’t until 2011 that I first used them, when I had the opportunity to learn C#. At the time, I needed a working knowledge of the language – enough to do some minor debugging – but I never really dived into the details. Over the last few months I’ve found myself getting more involved with updating C# and VB.NET code, leading to a desire to go more in-depth into C# and the framework. Given the reviews, I’ve had my eye on CLR via C# for a while, so the new edition pushed it to the top of my reading list.
In the past I haven’t been very impressed with the level of editing at Microsoft Press (I absolutely detested their book on SQL Server 2008) but they’ve definitely improved lately; CLR via C# is a pleasure to read. As the title would imply, the book covers the various features of the Common Language Runtime using C# sample code (and mentioning other languages when the designers of C# chose not to implement something that the runtime supports). The author also throws in his own opinions on various design decisions, which I find interesting.
I have two problems with most programming books. The first is that they tend to be boring to read. The second is that they tend to be written at one of two levels: either they assume you’re an absolute beginner and work up from Hello World (here’s what assignment is, here’s what a loop is, here are the ways to write one) or they assume that you’re already completely fluent in one language and just want a dictionary to convert that to another language. In the first case, anyone who isn’t a beginner is bored out of his or her mind (bringing us back to point one); in the second case, the book is hard to use unless you’re already familiar with the concepts and the language the author assumes you’re coming from. For myself, I learned to program around 1988 and programmed on and off until 2004, when I became a math teacher; when I started writing code again, what I needed is something that would explain concepts I wasn’t familiar with (partial classes, delegates, etc) without first requiring me to wade through the programming equivalent of “See spot run”.
CLR via C# is one of very few books I’ve seen that manages to strike that kind of balance. While it throws in a lot of the basics – value types vs reference types, for example – they’re used in the context of explaining how something is implemented in the CLR, so it still keeps my interest. The text is nicely cross-referenced, which has the helpful side effect of reminding you (if you’re reading the book straight through as I chose to do) whether or not it’s referring to something you’ve already covered, as well as either reinforcing already-learned material or previewing more advanced structures.
When I started the book I got bogged down a bit in the first section, which covers how the assemblies are put together, but I felt it really picked up from there. For me it clarified a few concepts that I’ve seen referenced but never formally learned. As a matter of personal preference I also liked that while the code was in the CLR language I use most, the book also mentioned areas where the differences between the languages affect code interacting between them. Overall, highly recommended.
Disclosure: I received a free review copy of this book.