Training
Module
Store and Retrieve JSON Files - Training
Learn how to serialize and deserialize JavaScript Object Notation (JSON) strings using the JsonSerializer class, the JsonSerializerOptions class, and Data Transfer Objects.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
.NET 5 is the next major release of .NET Core following 3.1. This release was named .NET 5 instead of .NET Core 4 for two reasons:
ASP.NET Core 5.0 is based on .NET 5 but retains the name "Core" to avoid confusing it with ASP.NET MVC 5. Likewise, Entity Framework Core 5.0 retains the name "Core" to avoid confusing it with Entity Framework 5 and 6.
.NET 5 includes the following improvements and new features compared to .NET Core 3.1:
.NET 5 and later versions are the main implementation of .NET going forward, but .NET Framework 4.x is still supported. There are no plans to port the following technologies from .NET Framework to .NET 5, but there are alternatives in .NET:
Technology | Recommended alternative |
---|---|
Web Forms | ASP.NET Core Blazor or Razor Pages |
Windows Workflow (WF) | Elsa-Workflows |
The original implementation of Windows Communication Foundation (WCF) was only supported on Windows. However, there's a client port available from the .NET Foundation. It's entirely open source, cross platform, and supported by Microsoft. The core NuGet packages are listed below:
The server components that complement the aforementioned client libraries are available through CoreWCF. As of April 2022, CoreWCF is officially supported by Microsoft. However, for an alternative to WCF, consider gRPC.
New application development can specify the net5.0
Target Framework Moniker (TFM) for all project types, including class libraries. Sharing code between .NET 5 workloads is simplified: all you need is the net5.0
TFM.
For .NET 5 apps and libraries, the net5.0
TFM combines and replaces the netcoreapp
and netstandard
TFMs. However, if you plan to share code between .NET Framework, .NET Core, and .NET 5 workloads, you can do so by specifying netstandard2.0
as your TFM. For more information, see .NET Standard.
Developers writing .NET 5 apps will have access to the latest C# version and features. .NET 5 is paired with C# 9, which brings many new features to the language. Here are a few highlights:
Records: Reference types with value-based equality semantics and non-destructive mutation supported by a new with
expression.
Relational pattern matching: Extends pattern matching capabilities to relational operators for comparative evaluations and expressions, including logical patterns - new keywords and
, or
, and not
.
Top-level statements: As a means for accelerating the adoption and learning of C#, the Main
method can be omitted, and an application as simple as the following example is valid:
System.Console.Write("Hello world!");
Function pointers: Language constructs that expose the following intermediate language (IL) opcodes: ldftn
and calli
.
For more information on the available C# 9 features, see What's new in C# 9.
In addition to some of the highlighted new C# features, source generators are making their way into developer projects. Source generators allow code that runs during compilation to inspect your program and produce additional files that are compiled together with the rest of your code.
For more information on source generators, see Introducing C# source generators and C# source generator samples.
F# is the .NET functional programming language, and with .NET 5, developers have access to F# 5. One of the new features is interpolated strings, similar to interpolated strings in C#, and even JavaScript.
let name = "David"
let age = 36
let message = $"{name} is {age} years old."
In addition to basic string interpolation, there's typed interpolation. With typed interpolation, a given type must match the format specifier.
let name = "David"
let age = 36
let message = $"%s{name} is %d{age} years old."
This format is similar to the sprintf
function that formats a string based on type-safe inputs.
For more information, see What's new in F# 5.
There are no new language features for Visual Basic in .NET 5. However, with .NET 5, Visual Basic support is extended to:
Description | dotnet new parameter |
---|---|
Console Application | console |
Class library | classlib |
WPF Application | wpf |
WPF Class library | wpflib |
WPF Custom Control Library | wpfcustomcontrollib |
WPF User Control Library | wpfusercontrollib |
Windows Forms (WinForms) Application | winforms |
Windows Forms (WinForms) Class library | winformslib |
Unit Test Project | mstest |
NUnit 3 Test Project | nunit |
NUnit 3 Test Item | nunit-test |
xUnit Test Project | xunit |
For more information on project templates from the .NET CLI, see dotnet new
.
There are new features in and for System.Text.Json:
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Training
Module
Store and Retrieve JSON Files - Training
Learn how to serialize and deserialize JavaScript Object Notation (JSON) strings using the JsonSerializer class, the JsonSerializerOptions class, and Data Transfer Objects.
Documentation
What's new in .NET Core 3.1 - .NET
Learn about the new features found in .NET Core 3.1.
Learn about the new features introduced in .NET 6.
What's new in .NET Core 2.0 - .NET
Learn about the new features found in .NET Core.