Apr 18, 2023·1 min read

Microsoft Showcases C# 12 Language Enhancements as part of .NET 8 and Visual Studio 17.6 Previews

Microsoft has unveiled new features for the C# 12 language, such as primary constructors for non-record classes, alias support for any type, and default values for lambda expression parameters. These enhancements are part of the latest .NET 8 and Visual Studio 17.6 previews.

Microsoft Showcases C# 12 Language Enhancements as part of .NET 8 and Visual Studio 17.6 Previews

Microsoft has recently revealed new enhancements to the C# 12 language as part of the latest .NET 8 and Visual Studio 17.6 preview releases. These updates include primary constructors for non-record classes and structs, the ability to use aliases for any type, as well as default values for lambda expression parameters.

.NET 8 Preview 3, which was unveiled on April 11th, contains these new C# 12 features. The general availability of both the C# 12 and .NET 8 platforms are anticipated for this November. In addition, developers can also explore the C# 12 updates in the most recent Visual Studio 17.6 preview.

Primary constructors enable developers to include parameters directly in a class declaration, utilizing them within the class body, such as initializing properties or incorporating them in method and property accessor code. Initially introduced for records in C# 9 as part of positional syntax, C# 12 extends this functionality to other structures and classes.

The latest C# 12 version also broadens alias support to encompass any type. Microsoft clarifies that the using alias directive can be applied to alias any type, beyond just named types. This allows for the creation of semantic aliases for tuple types, array types, pointer types, or other unsafe types.

In addition, C# 12 augments lambda expressions by permitting developers to define default values for parameters. The syntax and rules align with those of adding default values for arguments to any local function or method. Default values for lambda expressions are described as a significant advancement in empowering lambda expressions.

Microsoft is actively seeking feedback on these new C# features and developers are encouraged to share their thoughts on primary constructors, alias any type, and default values in lambda expressions through dedicated channels.

Besides the C# 12 updates, .NET 8 Preview 3 presents changes to build paths, workloads, Microsoft.Extensions, and containers. It also delivers performance enhancements in the JIT compiler for Arm64 and dynamic Profile Guided Optimization (PGO). The release of .NET 7 in November 2022 introduced an updated version of C#, accompanied by performance improvements, container and cloud-native tooling, and extensive upgrades to .NET MAUI, among other .NET libraries and frameworks.

While traditional programming languages and platforms continue to evolve, companies like AppMaster are focusing on providing no-code solutions for developers, minimizing the complexity of software development. With over 60,000 users, AppMaster has proven itself as a powerful platform for creating backend, web, and mobile applications without the need for extensive coding knowledge. Learn more at studio.appmaster.io.

Easy to start
Create something amazing

Experiment with AppMaster with free plan.
When you will be ready you can choose the proper subscription.

Get Started