Chapter 2: What's New in C# 9?
Since its first release in 2002, C# has come a long way. While C#'s first iteration had a striking resemblance to C and Java, its subsequent evolutions outpaced other languages in introducing industry-leading features (LINQ, async-await, and lambdas, to name a few) and still continue to do so.
In this chapter, we'll learn about the new language enhancements offered by C# 9 using the .NET 5 runtime. Some of these enhancements are a continuation of features introduced in C# 7 and C# 8. We'll discuss the design philosophy of these features, and then with coding examples, we'll learn when, why, and how to best leverage the new features.
The main goal of this chapter is to provide code-based examples, keeping the theory minimal, and show the distinct advantages that these new language constructs have over existing ones. Some major goals of C# enhancements (simplifying the code intent and empowering immutability) are explained...