Skip to main content

About this book

This is not an exhaustive C# reference.

Instead, this book focuses on the parts of C# that are core, advanced, or simply take time to master. Unlike traditional programming books, this one emphasizes “deep understanding” and encourages you to use AI tools to support your learning and development. In an age when AI can generate vast amounts of code, developers need better judgment about code quality, security, and performance, along with the skill to guide AI precisely toward high-quality C# code.

Who this book is for

This book is for developers who already have a foundation in C# or another programming language and want to learn modern C# syntax and practical details. It does not cover programming fundamentals or basic C# syntax, such as:

  • How to call functions and pass parameters
  • Basic loops and control flow
  • Core object-oriented concepts (classes, inheritance, polymorphism)

What makes this book different

This book covers key language features from C# 7 through C# 15, with an emphasis on modern, advanced, and practical programming techniques. It also covers .NET 11 features such as Runtime Async in Chapter 12. The code samples target .NET 11.

Even so, Chapter 1 still starts with the simplest possible “Hello World” example, so that readers with experience in other languages can quickly get oriented in the .NET world.

How to read this book

You can read it cover to cover, or jump straight to topics you’re interested in. If you run into syntax that feels unfamiliar, return to earlier chapters and review the fundamentals.

Chapter dependency notes:

  • Chapters 1–3 are foundational; it’s best to start there.
  • Chapter 8 (Delegates and lambda expressions) provides prerequisite knowledge for Chapter 10 (LINQ).
  • Chapter 9 (Events and the publish-subscribe pattern) provides helpful background for callbacks, notifications, and continuations in Chapter 12 (Async).
  • Chapter 7 (Generics) is very helpful for understanding LINQ and collection operations.
  • Chapter 11 (Extension Methods) helps you understand how LINQ works.
  • The resource ownership concepts in Chapter 5 also apply to subscription lifetimes in Chapter 9, asynchronous operations in Chapter 12, and memory pools in Chapter 13.

Hands-on practice is still the best way to learn. When questions or ideas come up, write a small program to test them. It helps you build intuition, confirm that you truly understand, and dig into the “obvious” details until they’re actually clear.

Reading device recommendation: For the best reading experience, we recommend reading this book on a computer or tablet, using either a browser or an app. If you prefer a dedicated e-reader, aim for a larger screen (10 inches or more), as smaller devices are more likely to cause layout issues with code samples.

Learning approach

To help you learn more effectively, this book takes the following approaches:

  • Side-by-side comparisons: For easily confused concepts, we compare different approaches to the same requirement, explaining their behavior, when each approach is appropriate, and the trade-offs involved. When an approach is incorrect or risky, we explain why.
  • Visual aids: Diagrams are used where helpful to clarify complex ideas.
  • Practice-oriented: Not just “how,” but also “why,” “when to use,” “when not to use,” and the potential performance impact.
  • Food for thought and AI-assisted development: Predict program behavior, then run and verify it. AI-assisted development in practice emphasizes code review, testing, and checking documentation.
  • C# version notes: We mark which C# version introduced a feature to help you understand the language’s evolution.
  • Sample code links: All sample code is published on GitHub, and the book includes links where appropriate.

Tools used in this book

To follow along with the hands-on exercises, you’ll need:

  • .NET 11 SDK or later
  • An IDE or editor: Visual Studio 2026 (or VS Code, Rider, etc.)

For installation steps and tooling suggestions, see Section 1.2 of “Chapter 1: Fundamentals.”

Sample code

The sample code for this book is hosted on GitHub:

https://github.com/huanlin/modern-csharp-v2-web/tree/main/example-code/en