A (Belated) Welcome to C# 7.3

A (Belated) Welcome to C# 7.3

Better late than never! Some of you may have noticed that C# 7.3 already shipped, back in Visual Studio 2017 update 15.7. Some of you may even be using the features already.

C# 7.3 is the newest point release in the 7.0 family and it continues themes of performance-focused safe code, as well as bringing some small "quality of life" improvements in both new and old features.

For performance, we have a few features that improve ref variables, pointers, and stackalloc. ref variables can now be reassigned, letting you treat ref variables more like traditional variables. stackalloc now has an optional initializer syntax, letting you easily and safely initialize stack allocated buffers. For struct fixed-size buffers, you can now index into the buffer without using a pinning statement. And when you do need to pin, we’ve made the fixed statement more flexible by allowing it to operate on any type that has a suitable GetPinnableReference method.

For feature improvements, we’ve removed some long time restrictions on constraints to System.Enum, System.Delegate, and we’ve added a new unmanaged constraint that allows you to take a pointer to a generic type parameter. We’ve also improved overload resolution (again!), allowed out and pattern variables in more places, enabled tuples to be compared using == and !=, and fixed the [field: ] attribute target for auto-implemented properties to target the property’s backing field.

All of these features are small additions to the language, but they should make each of these parts of the language a little easier and more pleasant. If you want more details, you can see the 15.7 release notes or check out the documentation for What’s new in C# 7.3.

Andy Gocke
C#/VB Compiler Team