Book Review: Concurrency in C# Cookbook by Stephen Cleary

If you want to know how to use .NET to write asynchronous, parallel and multi-threaded code with modern C# you have found the right book. In the 2nd edition, Stephen Cleary intentionally left out all legacy approaches of .NET’s earlier days and takes on the modern and recommended-to-use approaches:

  • async/await for asynchronous programming, especially for I/O-bound work (including up-to-date information on asynchronous streams)
  • Parallel and PLINQ for compute-bound work
  • TPL Dataflow for data processing pipelines
  • System.Reactive for event-based programming working on observables (also suitable for time-based queries)

In additional chapters he sheds light on important and often overlooked topics regarding testing concurrent code, interop between the approaches, concurrent collections, cancellation as well as synchronization and scheduling.

The content is presented in form of recipes for concrete tasks you may encounter. So you can certainly use this book as a reference on your desk, a little helper for your everyday work.

Although Stephen gives a short preface to the four modern approaches at the beginning of the respective chapters, the recipe-style of the book fails to give a good introduction on how to get going and when exactly to use them. You either have to already have some experience with them to follow along or read some additional material on the web.

Altogether a must-read for every professional C# developer.

Leave a Reply

Your email address will not be published. Required fields are marked *