Posts about C# 14
Operator overloading has been a part of C# since its very first version. The functionality has remained the same until the introduction of generic math in C# 11 when some changes were made to shift operator overloading and support for checked overloaded operators was added. C# 14 is now adding support for overloading compound assignment operators.
In my previous two blog posts, I wrote about extension members in general and generic extension members. But there's one more topic related to extension members I'd like to cover: how ambiguous extension member references in code can be resolved.
I already wrote about extension members in C# 14 in my previous blog post, but I only covered the non-generic members. Since generics were fully supported in extension methods, they are of course also supported in extension members.
Extension members are the largest new feature of C# 14. We have been hearing about it for quite a while, also under the name of extension everything and extension types. It was expected to be released in C# 13, but then postponed. Now it's finally here. With a different syntax and some functionalities removed (explicit extensions, for example). But it's still a big addition to the language.
The next C# 14 feature I took a closer look at was the field keyword. Similarly to the null-conditional assignment, it can reduce some of the boilerplate code you need to write. But it's not just syntactic sugar. You might need less private fields in your classes thanks to it.
As the release of C# 14 is coming closer and most of the features are already available in preview, I decided to try them out myself. I started with null-conditional assignment, a syntactic sugar feature that can help you get rid of some null checks in your code.