Microsoft releases .NET 7 together with C# 11

My Top Five .NET 7 Features

ASP.NET Core Nov 29, 2022

Microsoft recently released .NET 7 to the public and after a thoughtful consideration here are my top five pick of this year's release. Keep in mind that the order of the features is completely random. You can download .NET 7 right here. As all new .NET releases, this version is available for Windows, macOS, and Linux operating systems. .NET is a Standard-Term Support (STS) version, which means it will receive updates for at least 6 months after the next major release. With the current schedule, this means, that updates will last for a total of 18 months after the initial release. By then, with .NET 8, the next Long-Term Support (LTS) version will already be available.

.NET Multi-Platform App UI (.NET MAUI)

.NET MAUI finally makes it into the General Availability (GA) status. With this new feature, it’s possible to create both mobile and desktop class application with C#, XAML and a shared codebase. Currently, macOS, Windows, iOS, iPadOS and Android are supported. Keep in mind that this list may change in the future as new systems emerge. Basically .NET MAUI is an advance development of Xamarin.Forms, which is great news for anyone who has experience with Xamarin.

Microsoft Learn has an excellent starting point to learn more about .NET MAUI here.

.NET MAUI. Image by bitrise.

Modern Cloud: Cloud Native and Container

With .NET 7 the integration and support for Cloud Native and containerized solutions are significantly improved. The creation of docker containers should be possible within the build-publish process, removing the need for an explicit docker build phase. Thus removes some of the docker boilerplate code and makes the overall source code cleaner.

Also, the start and execution of docker container when running .NET 7 application should be faster than before.

Containerized cloud image.

Performance Improvements (A lot)

Like every previous release, .NET 7 is no exclusion when it comes to performance improvements. There is a huge number of minor changes which will eventually build up to an overall faster application, quicker responses and improved startup times.

There are plenty of performance improvements with .NET7

Stephen Tourt - MSFT has his say on all the performance improvements with .NET 7:

.NET 7 is fast. Really fast. A thousand performance-impacting PRs went into runtime and core libraries this release, never mind all the improvements in ASP.NET Core and Windows Forms and Entity Framework and beyond. It’s the fastest .NET ever. If your manager asks you why your project should upgrade to .NET 7, you can say β€œin addition to all the new functionality in the release, .NET 7 is super fast.”

A detailed list of all the improvements is linked here.

C# 11 Support

As with every new .NET version recently, C# also gets a new major version bump. This year, the C# version jumps to 11 and brings some neat features and more sugar syntax. The most eye-catching new features in C# 11 are probably raw string literals and support for generic attribute.

Raw string literals

With raw string literals, it is finally possible to create multi-line text without the clutter of string concatenation. The new functionality is indicated by at least three opening double-quotes. After that, you can put any text you want, even arbitrary text, including whitespace, new lines, embedded quotes, and other special characters without requiring escape sequences. This makes long text in the source code so much more readable!

string longMessage = """
    This is a long message.
    It has several lines.
        Some are indented
                more than others.
    Some should start at the first column.
    Some have "quoted text" in them.

In addition to that, you can control the number of curly braces needed to start in interpolation and end it. When using a single dollar sign to start the text, double curly braces are needed. By adding another dollar sign at the beginning, you need one more - a total of three - curly braces to start the interpolation.

Multiple $ characters denote how many consecutive braces start and end the interpolation.
var location = $$"""
   You are at {{{Longitude}}, {{Latitude}}}

To learn more about strings in C# in general, visit this article.

Generic attributes

Before C# 11 you could not simply create a generic attribute. The only possible way was to pass a Type via the constructor to the Attribute.

// Before C# 11:
public class TypeAttribute : Attribute
   public TypeAttribute(Type t) => ParamType = t;

   public Type ParamType { get; }

At usage, you could only pass the type via the typeof operator

public string Method() => default;

Now in C# 11 you can specify a real generic approach with attributes.

// C# 11 feature:
public class GenericAttribute<T> : Attribute  

At usage, this looks much cleaner and easier to read.

public string Method() => default;

A full list of new C# 11 features is linked here.

HTTP/3 Support

.NET 7 add support for HTPP/3, which is as the name suggest the third major version of the Hypertext Transfer Protocol (HTTP). Unlike both previous versions, HTTP/3 does no longer user TCP as the communication protocol, but uses QUIC - which is pronounced β€œquick”. QUIC builds on the UDP protocol, which allows a faster data transmission by ignoring lost packets and error checking. Find out more about UDP here.

HTTP/3 Support is now available with .NET7 

Chrome, Edge and Firefox supports HTTP/3 by default and Safari is the only browser, where the support is disabled by default.

HTTP/3 has lower latency and loads more quickly in real-world usage when compared with previous versions: in some cases over 3Γ— faster than with HTTP/1.1 (which remains the only HTTP version deployed by many websites) - source.

A lot more

There are quite many further adjustments, and I like to make some honorable mentions at the end.

  • Improvements for Minimal APIs
      – New filters, new bindings, TypedResult, better testability and much more.
  • Blazor Hybrid Support.
      – Existing Blazer components can be embedded in desktop apps via WebView controls.

As with every update, there are some breaking changes to previous versions. A (nearly) complete list of all the breaking changes is available here.

At the end you find a video of the .NET Conf 2022 where all the new features were discussed and shown.


Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.