What’s New in the 4th Edition
The 4th Edition is an almost complete reimagining of The C# Player’s Guide. I didn’t intend on such a significant rework when I started, but it’s where I ended up at. I sometimes feel like I literally rewrote the book twice in this process. There is hardly a sentence that didn’t get touched, and many chapters got a complete rewrite.
Yet the book is the same book at its heart. Or maybe you could say that the 4th Edition is finally what I had hoped the 1st Edition would be, and it has just taken until now for it to finally get here.
The major new features are these:
- Reimagined the book to be better aligned with the idea of it being a player’s guide, and that the game to play is programming and learning to program.
- In a Nutshell sections are now Speedrun sections.
- Try It Out! sections are now Challenge sections.
- Quiz sections are now Knowledge Check sections.
- Some sections are now Side Quests, which mark a section as something reasonably safe to skip.
- Chapters are now called Levels.
- Lots of additional challenges were added, and they form a loose storyline/plot for new programmers to follow.
- By completing challenges, you now gain XP, which you can track as you go through the book.
- I tried to flatten out the learning curve around object-oriented design a bit better. The book isn’t specifically about design, but it is important for people to understand the basics to be able to do things in C#. So the book contains more information about how to break a large program into smaller parts and then combine those parts to form the final solution.
- New website focused on just this book, cutting out other clutter (you’re here).
- Updated to C# 9:
- Top-level statements - the book fully embraces this new model throughout the book and solutions.
- New pattern tools - added to the Patterns chapter, which was completely rewritten:
- Parenthesized patterns.
- Comparison patterns (
>=
,<=
,>
, and<
). and
,or
, andnot
patterns.
init
accessors - added to the properties chapter, used by records.- Records - added a whole new chapter.
- Covariant return types (you can now override a method with a more specific return type) - added to the polymorphism chapter.
- Native integer types (
nint
andnuint
) - added a small section in the Unsafe Code chapter. - Using
static
to disallow capturing variables - added to the section talking about closures. - Using just plain
new ()
in cases where the type can be inferred - called out in the book, though most of the book still explicitly names types (a similar argument for why the book usesvar
). - Partial methods are now much more flexible - the section about partial methods and classes got completely rewritten, but it is a small section in the back of the book.
- A handful of other small things.
- Updated to .NET 5. 3rd Edition was focused on .NET Framework, but the .NET world has changed substantially in the last few years. Everybody who can should be using .NET 5 (the evolution of .NET Core) whenever possible now (and if not, then .NET Core 3.1, and only use other stuff when necessary).
- More emphasis on other IDEs aside from Visual Studio. Visual Studio is still central, but Visual Studio Code got a lot more love in this version.
- Lots of other stuff to improve clarity and fix typos throughout the book.