Here’s Why .NET 7 Is A Game Changer For Cross Platform Development

Ollie Spear
The Tech Collective
3 min readFeb 1, 2023
Photo by Marvin Meyer on Unsplash

It’s almost been 3 months since the release of .NET 7, which was packed with new improvements and features. From improved performance and productivity to WebAssembly support, there’s something for everyone in this latest release!

WebAssembly, or wasm for short, is a low level assembly language which allows developers to write applications in a range of different programming languages that can be run in modern web browsers at near-native speed. In 2018, Microsoft released Blazor, a framework to build full stack web apps by harnessing the power of .NET and C# without the need to write any JavaScript. Blazor comes equipped with multiple methods of deployment such as native client apps, server-side, and WebAssembly.

Up until this point, The use of WebAssembly with C# and .NET was tightly coupled to the Blazor framework, however, with the WebAssembly support changes that came with .NET 7, this now means that you can utilise WebAssembly with C# and .NET independently of Blazor. What does this mean? Less dependencies and more power! Who wouldn’t want to have their cake and eat it too?

Back in May last year (2022) .NET Multi-platform App UI (MAUI) was launched, which for those of you who aren’t aware is a cross-platform framework designed for creating both native mobile and desktop applications with C# and XAML, allowing you to develop one codebase and deploy to multiple devices such as Android, IOS, macOS and Windows. .NET 7 comes equipped with a host of new functionality for .NET MAUI as well as performance improvements including reduced package size for IOS, improved startup times for Android and much more lower level technical performance improvements related to application layout and scrolling performance as well as offering two architectures for macOS to avoid Rosetta translation wait times.

Another major feature of .NET 7 also now allows you to create containerised versions of your applications. Containers are one of the simplest ways to package and deploy a range of different applications and services in the cloud, and with just a few extra flags on the dotnet publish command you can now go from nothing to a fully running containerised ASP.NET Core application that you can spin up using Docker. Cool right?

.NET 7 also brings improved productivity and performance. There have been changes to the Garbage Collector (GC) with a new feature called ‘Regions’ which have replaced the current ‘Segments’ approach to managing memory on the Garbage Collector heap. This means the GC now has many smaller regions of memory (~ 4MB each) to maintain which allows the GC to be more nimble and efficient when repurposing regions, as opposed to its ‘Segments’ predecessor which held a much larger capacity (up to 4GB).

On top of that, .NET 7 comes with a bunch of improvements to Collections. To elaborate, Collections themselves (From the System.Collections package) haven’t received many direct changes but Collections have seen some speed improvements as a by-product of some lower level improvements. A great example of this is the Dictionary type which has had no code changes between .NET 6 and .NET 7 yet it is now faster. The same applies to the Sort method on an ImmutableArray type which has seen performance improvements by removing the need to implement multiple interfaces. This section is quite technical, but in summary it means you can tell your manager that upgrading to .NET 7 is a good idea because it’s super fast!

In conclusion, .NET 7 is packed with a range of new improvements and features, from WebAssembly support to fully fledged containerised ASP.NET Core applications and improved productivity and performance. In .NET 7 there’s something for every developer. So, go forth and embrace the new features that .NET 7 has to offer, and make your development life a little bit easier and a lot more fun. Happy Coding!

--

--

Ollie Spear
The Tech Collective

Software Engineer writing about software development and programming languages