.NET 6 | Everything You NEED to Know

.NET 6 | Everything You NEED to Know


Let’s start with a confession. I won’t be able to tell you everything new in .NET 6 - it’s just too much. 

Play

To give you a feeling of how much there is to cover, take a look at the official .NET 6 announcement blog post. Fun fact, if you print it, it would fill almost 70 pages.

However, I will highlight things I think will impact me the most and could also be interesting for most .NET developers.

With this short disclaimer out of the way, let’s jump into the first topic.

Why should I care? - End of Support

Honestly, it’s a valid question every developer should ask whenever there is a shiny new version of a framework or tool. However, with .NET 6 released, the end of life of .NET 5 isn’t that far away.

While .NET 6 is a long-term support version providing updates for at least three years, .NET 5 only is supported for six more months and will end on May 8th, 2022.

If you’re using .NET 3.1, you’ll receive updates until December 3rd, 2022.

It could be one of the reasons why you want to upgrade to .NET 6.

Why should I care? - Performance Improvements

The second reason is performance. I link a blog post with more details about specific things Microsoft changed to improve the performance of the .NET platform

I cannot go into details in this overview video because I don’t understand most of the improvements myself as they are very technical. And if you visit the page yourself, you’ll see that you need to purchase a forest before you can print it - it’s very, very long and detailed.

However, I can say from my own experience that existing .NET 5 apps can have noticeable performance improvements when migrating to .NET 6. I migrated an ASP.NET WebAPI application from .NET 5 to .NET 6, and I could notice the performance improvements without measuring it. 

If you have an existing application that you migrate to .NET 6, I would love to read a comment about how much better the performance is in your use case.

If your application has performance problems or runs in the cloud and you want to save computation time to reduce cost, .NET 6 will be your friend.

Visual Studio 2022

Visual Studio 2022 is available to download today. It’s been available as a preview version for a few months. I tested it myself, and I could see considerable improvements throughout the versions. 

Many new project templates make use of the new C# 10 and .NET 6 features.

One of the most important new features is hot reload. Hot reload lets you apply code changes into running applications to considerably reduce the time between code changes and seeing them in action.

I don’t show a demo of Visual Studio 2022 or hot reload in this video. Still, you can check out my other video where I talk about Visual Studio 2022 in more detail to learn how hot reload works in action and what’s new besides hot reload.

C# 10

With .NET 6, the default C# language version is C# 10. It’s only been a year since we got C# 9 with .NET 5. Still, we get a few new features that mainly focus on reducing the clutter in project templates and reducing the ceremony involved in creating .NET applications.

  • Global using directives are intended to reduce the number of using statements at the top of every file.
  • File-scoped namespaces allow you to reduce the nesting level in your files. 
  • Record structs allow us to generate struct types in addition to class types using the short type definition syntax.

There is so much more included in C# 10. Read more details about C# 10 here.

ASP.Net Core Minimal APIs

The traditional Asp.Net Core application templates are perfect for stand-alone applications. However, if you want to architect microservices and cloud-native applications, those templates can be a little too much.

That’s where Minimal APIs come into play. Minimal APIs allow you to create HTTP APIs with minimal dependencies and a minimal number of files.

Just take a look at the example of the official documentation. It reminds me a lot of Express in the Node.js world.

Blazor

I have a complete course on Blazor on this YouTube channel where you can learn the fundamentals of Blazor, including the powerful component model and much more.

Blazor also has a few new features with .NET 6. Let’s take a look at a few of them.

  • Dynamic components allow us to decide on runtime what component should be rendered based on the state of your application.
  • Hot reload also works in Blazor and allows for a rapid feedback cycle loop when working on Blazor components. There are situations where you need to restart the application, but they are infrequent, and with most edits, you can expect to use hot reload to see your changes in the browser almost as you save the file.
  • Error Boundaries is another additional feature that makes life as a Blazor developer easier. As its name promises, it allows you to create boundaries around parts of the component tree to stop exceptions from bubbling up the tree until the whole application crashes. Check out the ErrorBoundary component if you work with Blazor applications.

There is so much more. You can learn more about it on the blog post on the Telerik blog written by Jon Hilton.

.NET MAUI Preview 10

There are many new controls and more updates on various topics in .NET MAUI preview 10.

Microsoft announced that .NET MAUI will be officially released in early 2022.

Conclusion

I’m very excited to explore everything .NET 6 and C# 10, as well as Visual Studio 2022, have to offer in the following weeks. 

I’ll create more videos focused on different topics interesting for .NET developers. As always, I’d love to hear feedback from you on what your favorite features are and what you want to explore yourself.

Feel free to subscribe if you want to hear more from me, and make sure to like the video if you learned anything from this short overview of what’s new in .NET 6.

PREMIUM CONTENT
Get access to my C#/.NET Bootcamp Course and 100+ additional software development courses by industry-leading instructors on Zero To Mastery.
Get 10% OFF with the code: FRIENDS10