Microsoft is doubling down in the evolution of the C# language. They released C# 8.0 last year with many new features, namely the long-awaited nullable reference types.

For more information, you can read my complete coverage of the C# 8.0 features

Not even a few months have passed, and there's already a preview of C# 9.0 in the making. You can already play with it today!

New features in C# 9.0

Install the preview

To try out those features, you need to follow a few steps.

  1. Download and install the latest SDK (v5.0.100-preview.7 at the time of this writing)

  2. Open the .csproj in which you want to enable the C# 9.0 features' support and add <LangVersion>preview</LangVersion>.

e.g.

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net5.0</TargetFramework>
    <LangVersion>preview</LangVersion>
  </PropertyGroup>
</Project>
  1. Have fun!

Wrapping up

C# 9.0 is evolving quickly. To keep up with the upcoming announcements, you can :