Microsoft has released .NET 5.0, the latest major release in its .NET development platform which, amongst other updates, introduces the new C# 9 programming language.
.NET 5.0 is the first update to the platform since Microsoft announced that it would unify its developer toolset across platforms and operating systems. This means that, with .NET 5.0, developers have access to a single set of APIs, languages, and tools that can be used regardless of whether they are building desktop, mobile, cloud or Internet of Things (IoT) applications.
SEE: Top 5 programming languages for systems admins to learn (free PDF) (TechRepublic)
Similarly, .NET 5.0 allows developers to cherry-pick the parts of the .NET platform that they need. For example, if users want to target mobile and not WebAssembly, they don’t need to download WebAssembly tools. The same applies with ASP.NET Core and WPF, and developers have access to the same runtime, API and language capabilities with each app.
Performance has also been greatly improved across .NET 5.0, Microsoft said, and the platform now supports Arm64 Windows natively.
Meanwhile, application deployment options are better, with ClickOnce client app publishing, single-file apps, reduced container image size, and the addition of Server Core container images.
“With .NET 5.0 you have everything you need to build rich, interactive front-end web UI and powerful backend services,” said Microsoft.
.NET 5.0 also introduces the new C# 9.0 programming language, as well as F# 5.0, the new default language version for the .NET SDK and Visual Studio. Both have been tweaked to make code more expressive and easier to write.
C# 9.0, for example, enables developers to rid themselves of chunks of boilerplate code and instead write their main program at the top level.
SEE: How to become a developer: A cheat sheet (TechRepublic)
Another new feature is records, which C# lead designer Mads Torgersen discussed in an exclusive interview with TechRepublic in October 2020. Simply put, records are a reference type that allow a whole object to be immutable and make them act like a value instead.
While records can be mutable, they are primarily built for better supporting immutable data models, Torgersen said. In a blog post announcing the new programming language, he explained: “A record is still a class, but the record keyword imbues it with several additional value-like behaviors. Generally speaking, records are defined by their contents, not their identity. In this regard, records are much closer to structs, but records are still reference types.”
The full set of C# 9.0 features can be found on Microsoft’s dedicated ‘What’s new in C# 9.0‘ page.
SEE: Linux commands for user management (TechRepublic Premium)
Microsoft introduced .NET 5.0 all the way back in May 2019 as the next version of .NET Core and the successor to .NET Core 3.x. Both have near-identical platform support for Windows, macOS and Linux, meaning developers using .NET Core 3.1 should be able to adopt .NET 5.0 on the same operating system fairly easily.
“.NET 5.0 is another big release that should improve many aspects of your use with .NET. We have enabled a broad set of improvements, ranging from single file applications, to performance, to Json serialization usability to Arm64 enablement,” Microsoft said.
“While today may be your first day with .NET 5.0, we’ve been running .NET 5.0 in production at Microsoft for months. We have confidence that it is ready for you to use, to run your business and power your apps.”