C# in a Nutshell, from O’Reilly & Associates, bills itself as “a concise and thorough reference to the language,” but it actually seems more like two books—one on C# and one on .NET class libraries. The book does not discuss C# in as much detail as other C# books, but it is an excellent resource that will appeal to many C# programmers. In fact, it will be beneficial even to developers of other .NET languages.
C# in a Nutshell is broken into four sections. Part 1 introduces the .NET Framework and the basics of the C# language. Part 2 explains how the language will be used, with more extensive discussions of the .NET Framework. Part 3, which is quite short, has some XML documentation, naming and coding conventions, and a discussion of the .NET tools. These three sections, taken together, make up a cohesive set of 23 chapters that could be a book itself, taking up approximately 275 pages.
Part 4 is a quick reference section, which describes the .NET Framework class libraries—one library per chapter. This information takes up approximately 450 pages, providing a comprehensive list of the available classes in each namespace.
The first “book”
C# in a Nutshell begins with the obligatory .NET definition chapter and a look at what managed code is all about. This discussion is well written and will be useful even to those already familiar with the concepts. Next, the book moves into the basic C# syntax. While this section is helpful, it is not intended for a novice. C# in a Nutshell is definitely not an introductory book. Readers should have at least a passing knowledge of C#, if not a good level of experience with it, before tackling this book. The code examples in the early parts of the book are simple snippets of code with little explanation. This is fine for those familiar with C# but could be confusing to novice C# developers using this as their sole reference. The good news, of course, is that there is no lack of introductory books available on C#.
After examining how to create classes and showing some of the advanced C# features, the book moves on to explain common C# tasks, which are actually accomplished by using Framework classes. For example, a chapter on strings describes the built-in string type, the StringBuilder class, and the RegEx class for using regular expressions. Some of these chapters, such as those on threading and memory management, are very short. While these chapters are well written, they don’t provide the level of detail that some C# programmers might need. Again, that isn’t the purpose of this book, but it reinforces the fact that the first part of this book is meant for experienced C# developers.
Just before the book dives into the quick reference section, you’ll find a chapter on the command-line tools available in the Framework. This is an essential list for developers working with the Framework, even those who are used to Visual Studio .NET, which wraps many of these utilities. Understanding the command-line utilities and knowing how to use them is crucial in many circumstances, and this chapter will prove to be invaluable as you build, debug, and deploy applications.
The second “book”
After examining C# and many of the tasks normally performed, C# in a Nutshell moves into the quick reference section, which lists the various Framework namespace classes. Many developers have been looking for a good discussion of the available Framework classes, and that is exactly what this book offers.
The quick reference section lays out the properties, interfaces, and classes available in each of the Framework’s namespaces. While these items are shown using C# syntax, this section will be useful to any .NET developer and is highly recommended for VB.NET developers as well. A quick scan through the various namespaces will show you the items you can use in your applications. Each listed item includes a short description, and each chapter has a page or two that explains the purpose of that particular namespace.
As good as this section is, it would be more useful if there were some code examples. Of course, that’s not the focus of the book, and it would greatly expand the size of the book. It’s minor criticism, though; just having the Framework items listed and described is something most .NET developers will find invaluable.
Keep it at your fingertips
The first portion of the book provides a concise overview of C#—sometimes too concise. The explanations of many items are excellent, such as how the stack and the heap work, but other topics appear to be too light on details. While this part of the book is good, it is geared toward experienced C# developers and is not detailed enough to teach C# to a novice.
The quick reference section on the Framework classes, which takes up the majority of the book, is a guide that many developers will turn to over and over. So this is a book that belongs on many desktops, right by the computer. No matter what language you choose for .NET, you’re likely to find this book useful.