Book Review: C# Cookbook (2nd Edition), Jay Hilyard and Stephen Teilhet, O’REILLY


The C# Cookbook, Second Edition has been updated and revised for C# 2.0 and version 2.0 of the .NET framework, and despite the fact that version 3.5 of the .NET framework is imminent, it remains a must have book to have on hand. It is essentially a collection of examples showing how to solve specific programming problems (some of which you might not have even realised you have, such as boxing/unboxing and efficient string handling, to name just a few…)

The C# Cookbook has over 1100 pages and is arranged into 20 chapters, each of which focuses on a particular area in C#. Despite its size it is not daunting to read. Here are the topics covered:

  1. Numbers and Enumerations
  2. Strings and Characters
  3. Classes & Structures
  4. Generics
  5. Collections
  6. Iterators and Partial Types
  7. Exception Handling
  8. Diagnostics
  9. Delegates, Events and Anonymous methods
  10. Regular Expressions
  11. Data Structures and Algorithms
  12. Filesystem I/O
  13. Reflection
  14. Web
  15. XML
  16. Networking
  17. Security
  18. Threading and Synchronisation
  19. Unsafe Code
  20. Toolbox

This book is in O’Reilly’s ‘cookbook’ series Problem-Solution-Discussion format, and like other books in the series can either be read from cover to cover, or be used as a reference to shed light on a particular problem. Each ‘recipe’ starts with a description of the problem, followed by a complete, documented code sample showing you how to solve it, along with a detailed discussion of how and why it works, and any drawbacks. This format can also serve as an excellent way of mastering aspects of C#.

Like the other O’Reilly cookbooks, this book manages to strike a perfect balance between reference and instruction on real problems developers encounter every day. Hats off to Jay and Stephen for creating such a useful resource.

If you are a developer who writes C# code for a living, I would be surprised if you do not find something useful the first time you pick this book up. If you are thinking of buying just one book on C# 2.0, make it this one. Highly recommended for beginners and experts alike.

The only problem I have now is that I need to go and buy my own copy as this one is now on its way to the User Group library. Of course, I could just borrow it, but I would really like to have a copy on hand all the time…!

You can download the source code here: http://examples.oreilly.com/csharpckbk2/

You can purchase the book online here:
http://www.oreilly.com/catalog/csharpckbk2/
http://www.amazon.com/C-Cookbook-2nd-Cookbooks-OReilly/dp/0596100639

Disclosure: The Perth .NET User Group is a member of the O’Reilly User Group and Professional Association Program. O’Reilly make copies of their books available for user group libraries, and the copy reviewed here was kindly donated by O’Reilly. Thanks to everyone involved at O’Reilly for making this happen. That said, it has not been a factor in reviewing this book.