Blog Logo

Whats new in C# 12

This article highlights new features in C# 12, including primary constructors, default lambda parameters, and the ability to alias any type. These features can be tried out using the latest Visual Studio preview or .NET 8 preview SDK. Primary constructors can now be used in any class or struct, with parameters in scope for the entire body of the class. Default lambda parameters allow for defining default values for parameters on lambda expressions. The using alias directive can now alias any type, providing semantic aliases for tuple types, array types, pointer types, or other unsafe types. For more information, see the feature specification. For additional resources, including blog posts and previous versions, visit the Microsoft Learn website.