Verdict: Recommended
Steve Love’s C# Brain Teasers delivers 21 self-contained puzzles that expose the “dark corners” of C#. Each chapter poses a short snippet – ranging from closure capture pitfalls to enum‐switch gotchas, from DateOnly
constructors to IEEE-754 oddities – and challenges you to predict its behaviour before revealing the answer and a succinct, spec-driven explanation.
The format is its greatest strength:
- Bite-sized chapters (4–6 pp each) fit into a coffee break.
- Hands-on focus forces you to wrestle with real compiler quirks (e.g. why
n != double.NaN
never filters out NaNs) before showing the fix (!double.IsNaN(n)
) . - Up-to-date coverage, from collection expressions in C# 12 to the round-trippable “O” date format in .NET 8, keeps you current without overwhelming legacy users.
Love adopts a crisp, conversational tone. Topics range from closure capture, pattern-matching quirks, async void, and floating-point dictionaries to the hazards of user-defined conversions. All examples compile under .NET 8 / C# 12, and each explanation links to the relevant section of the spec or Roslyn issue.
Overall, C# Brain Teasers is an engaging, low-time-investment primer on C#’s trickiest behaviours – ideal for code-review koans, interview prep, or sparking team discussion. It won’t teach C# from scratch, but it will make you write it with greater care.
Website: https://pragprog.com/book/csharpbt