Discover .NET 5 Through 5 New Features and a Vision of the Future

Chris J.
The Startup
Published in
5 min readNov 26, 2020


.NET 5 : 5 new features… and M1 ?

.NET 5 hit the developer world a few days ago. One of the most major evolutions in the framework’s history, it confirms Microsoft’s strategy in terms of open-source and cross-platform development.

In fact, most of the features of this new framework were either developed, enhanced or suggested by the passionate .NET community. This drives Microsoft into building better products, responding directly to their users needs.

With .NET 5, they unified .NET 4.6 and .NET Core into a single vision for .NET. Their goal is to use the same platform in order to build any kind of dynamic application.

Literally any kind. From mobile and desktop apps (Xamarin/WPF), to front-end web development (Blazor), including REST (ASP.NET), gRPC and web sockets (SignalR). Oh, and they also have machine learning (ML.NET) and quantic programming (Q#).

Now, really, what’s new in .NET 5 ? Why is this going to change the lives of thousands of .NET developers ? What’s next in .NET 6 ?

That’s what we will find out.


Records are a feature that’s actually borrowed from Kotlin and its data classes.

Records are basically classes that behave like a reference type, which means there is no copy when you pass them as parameters to your member functions.

But they also behave like a value type in a sense that they implement a default member equality.

Records and their default member equality. Carapuce is French for Squirtle 😉

That means you don’t have to implement IEquatable yourself when you want to compare reference types. Now, that’s time saving!

With records, there’s also a new with keyword that permits you to specify values to fresh copies of records with a new fancy syntax.

Building a Squirtle from a Charmander. That’s unheard of !

Records are perfect for people working with data. The flexibility of a class, and the pragmatism of a struct. What a beautiful baby !

Also, I’ve been testing records with Dapper and it works like a charm.

Pattern matching improvements

C#9 introduces new keywords and, or and not.

Combined with a new syntax you can do things like this:

A straightforward way to compare values of strings.

You see, in the above example, you compare the string with the constants null and empty string. This replaces the tedious use of string.IsNullOrEmpty() .

You can also check if something is not null by writing a code like this:

Even your neighbor can understand your code now.

And it also works with numbers, and inside switch expressions for more advanced use cases. But I’ll let you experiment that by yourself.

Top-level programs

With that feature, C#9 almost becomes a scripting language just like Python.

Just like this, you can basically write C# code outside of the scope of a method or a class.

Yes, the above C# code compiles with a simple dotnet build.

This is very good for C# beginners, and can be useful for Unity developers, manipulating C# scripts all the time.

I’m curious about the future advanced uses of such a feature. I see that as a replacement to the use of Main function for configuration code. Typically while configuring a WebHost for ASP.NET.

This will allow C# developers to publish microservices that consists of just one C# file. That can be time saving for proof-of-concept apps or small apps like a chatbot or an AWS Lambda.

Json Enhancements

Now let’s talk about the framework itself. With .NET 5, Newtonsoft.Json has been replaced with System.Text.Json.

By doing that, Microsoft makes the .NET framework more independent and closely tied with framework evolutions.

In fact, that JSON framework migration had already started with .NET Core 3.1. With .NET 5, that evolution anchors itself even more into the framework with performance improvements and feature enhancements.

Such migration can also break existing code, as the engine of ASP.NET Core 2.0 was based on Newtonsoft.Json. Be careful when you migrate, especially if you used JsonPropertyAttribute. It’s now being replaced by JsonPropertyNameAttribute.


When we think about ASP.NET deployed in the cloud, it is common to think about Docker. With .NET 5, Microsoft removed a build pack dependency called buildpack-deps.

By doing that, they could decrease the docker image file by 40% on Debian Linux.

Just take a look at the below chart. That’s very good news.

Docker whale was on a diet for a while.

This basically means that every docker pull will be faster, resulting in faster deployments. Gotta go fast !

.NET 6 … and Apple Silicon ?

The announcement of the M1 chip (© Apple)

Finally, I want to talk about the next release of .NET, which is .NET 6.

As you may know, Apple announced in november new Mac computers with their own processors based on the ARM architecture. These processors are called M1. Their main advantage is that they are blazing fast compared to their Intel counterparts.

But transitioning to a hardware that’s so different from Intel infers that the software has to adapt to it. A thing that Microsoft didn’t do with .NET 5. Yet.

In this next release, Microsoft announced via a GitHub project that they will enable .NET support on Macs with Apple Silicon.

I personally think that this move is crucial for Microsoft, as it is a needed step to build a solid cross-platform development ecosystem.



Chris J.
The Startup

I’m a Tech Enthusiast and a passionate Software Engineer. I write about consumer tech and IT Engineering.