C# 10 came out November of 2021. Here are a few of my favorite features:
Record structs
Although I haven't had chances to use this feature (as of this writing), I can definitely see the benefit. Often while coding, we need objects that are simple holders of data. Records simplify the creating of these objects. They also improve multi-threading since they are immutable. We can read a Record without having to put a lock on it.
Global using directives
What a nice, simple addition to C#. Now we don't have to have that first unnecessary indentation simply because we placed something in a namespace, which we typically do for an entire file. Now we just place a line like this:
namespace ThisIsMuchBetter;
Constant interpolated strings
String interpolation was a fantastic addition to C#. In C# 10 that simply added one more nice feature: The ability to use these on const
assignment:
const string Language = "C#"; const string Platform = ".NET"; const string Version = "10.0"; const string FullProductName = $"{Platform} - Language: {Language} Version: {Version}";
CallerArgumentExpression attribute diagnostics
This feature helps a lot with diagnostics. This one is detailed here. They do an excellent job of explaining it.
Anything you don't like??
Sure. The sundry of new features that are added, but really not that necessary. I've watched C# grow for over two decades now. Release after release it's been great to watch. However lately I've reached a point to where I'd like them to stop. Really. It's a great language, and I'm really not held back in any way with it. But as they add more, the language bloats, and the knowledge base increases. Even if I don't use these new features, I have to be familiar with them incase I come across them. As programmers, we have plenty enough of new technology to keep up with, C# is one I'd like to leave as is, personally.