main banner


C# 10 features that will help you the most in 2022

The .NET Team and community released C# 10 at the .NET Conf 2021 last November, and we can’t get enough of the improvement that came with it (Visual Studio 2022 and .NET 6).

Whether you’re a developer who appreciates performance speed or one that’s looking to get more with less, you’ll be happy to know that C# has been upgraded to be an excellent language for today’s standards, allowing you to simplify and shrink your code more efficiently.


Major improvements


C# is such a powerful language to build your applications. How can an already good language be better? These are some of the improvements that will boost your application and coding experience:


  • Records changes

    • With statement allows you to create a copy of a new type of class named the record, but altering a specific value.

    • Records can also be structs, instead of class.

  • Global usings

    • With this file you can bring all the using statements accessible to your application by only writing ‘global’ before.

  • File-scoped namespace

    •  This gives you the ability to take back horizontal space in your code. You normally don’t put more than 1 namespace per file, so now you can simply put a semicolon at the end of the namespace and get rid of the braces.

  • Easy enabling C# 10 on older projects

    • Update <LangVersion> property to 10 on .csproj file and now Visual Studio can help you refactor your project to use all these new features automatically.

  • Implicit usings

    • You can list the namespaces that you want to use everywhere (e.g. all the System ones) only by editing the .csproj file with the property <ImplicitUsings>enable</ImplicitUsings> and have these namespaces automatically working. You find these auto-generated usings on the “/obj/Debug/net6.0/[AppName].GlobalUsings.g.cs” file.

  • Lambda expressions

    • Finally, delegates can now be stored in a var object and the compiler will automatically know the type T result that you’re gonna have. It works with functions too.



There are a bunch of improvements that we can talk about for this update, and I can’t just close this post without mentioning other cool stuff you can check out, such as extended property patterns, const interpolated strings, record types’ ability to seal ToString(), and much more. Take a look at the official documentation here.

José Carlos G.

A developer with a passion for music and arts. Gaming, basketball, swimming, electronics, and languages are also great ways to spend your time. Normally, I'm one of those people who's passionate about something until learning the most specific details: from reading shampoo's instructions to following a technical manual to the letter. I'm grateful to live for what I've learned and I'm always looking for a way to share. I enjoy nature and genuine experiences, I'm a simple person.