New Features of .NET 8

.NET 8

Microsoft released and introduced the .NET 8 on Nov 14th, 2023, the latest Long-Term Support (LTS) version of a premier development platform. .NET 8 brings forth numerous enhancements in performance, stability, and security. Additionally, it incorporates improvements in platforms and tools, fostering increased developer productivity and innovation velocity.

In this latest release, .NET transforms the landscape of constructing intelligent, cloud-native applications and high-traffic services designed to scale dynamically. Whether you opt for deployment on Linux or Windows, utilize containers, or follow a preferred cloud app model, .NET 8 simplifies the process of building such applications. It encompasses a collection of established libraries currently employed by numerous high-scale services at Microsoft. These libraries address fundamental challenges related to observability, resiliency, scalability, manageability, and beyond.

.NET 8 seamlessly incorporates extensive language models such as OpenAI’s GPT into your .NET application. Leverage a unified and robust component model for addressing all your web UI requirements through Blazor. Furthermore, you can effortlessly deploy your mobile applications on the newest versions of iOS and Android using .NET MAUI. Additionally, you can explore enhanced language features in C# 12 that enhance code conciseness and expressiveness.

You can download the .NET 8 SDK from here or you can use Visual Studio 2022 latest release Visual Studio 2022 17.8 release. If you have already Visual Studio 2022, then you can just upgrade to Visual Studio 2022 17.8 from the Visual Studio installer itself.

The features of .NET 8, as announced on the official Microsoft DevBlog, encompass a myriad of advancements. This release is characterized by thousands of improvements in performance, stability, and security.

Some of the Key Features are:

C# 12

  • .NET 8 release with C#12. In C# 12, any class or struct can now have primary constructors created with a concise syntax, eliminating the need for boilerplate code to initialize fields and properties. More here: Primary Constructor in C#
  • Additionally, we can use new default values for parameters in lambda expressions, which enhance code expressiveness.
  • You don’t need more overloading or null checks to handle optional arguments.
  • Moreover, can use the using directive to alias any type, not just named types.

ASP.NET Core 8

  • In ASP.NET Core 8 application you can see significant performance improvements, up to 18%, compared to .NET 7.
  • Native Ahead-of-Time (AOT) support for producing self-contained apps compiled into native code, resulting in smaller deployment size, quicker startup, and reduced memory usage.

Entity Framework Core 8

  • Entity Framework Core 8 supports for complex types for value objects (without identity), for example Address or Coordinate is included.
  • You can find the added support for lazy-loading of no-tracking queries for your program.

Performance Enhancements

  • Introduction of Dynamic Profile-Guided Optimization (PGO), optimizing code based on real-world usage, improving app performance by up to 20%.
  • Rewriting certain methods for better performance, including List<T>.AddRange(IEnumerable<T>) and Int32.ToString().

Cloud-Native Stack (.NET Aspire)

  • .NET Aspire is another cool feature added in the .NET 8.
  • The .NET 8 has first preview of .NET Aspire, an opinionated stack for building resilient, observable, and configurable cloud-native applications.
  • You can develop specific components for cloud-native development, such as a dashboard, telemetry, configuration, health checks, orchestration, etc.

Getting started with cloud native app with .NET Aspire can be found here.

Artificial Intelligence

  • .NET 8 makes ease of use of AI via first-class out of the box AI features in it’s SDK.
  • .NET 8 brings several enhancements to the System.Numeric library to enhance compatibility with Generative AI into .NET application. You can infuse AI into your .NET applications easily.
  • Large language Model integration with semantic Kernel.
  • It is simple to get started with Azure Open AI and Azure Cognitive Search SDKs in .NET 8.

Blazor Enhancements

  • Now, you can use Blazor for both client-side (Blazor WebAssembly) and server-side (Blazor Server) rendering in the same app.
  • It supports stateless server-side rendering, streaming rendering, progressive enhancement for navigation and form handling, and interactivity per component.

.NET MAUI

  • .NET MAUI is Successor to Xamarin.Forms, enabling the creation of projects for different platforms (WinUI, Mac, iOS, Android) with a single codebase.
  • .NET MAUI supports targeting iOS-like platforms.
  • .NET 8 release has introduced a new Visual Studio Code extension for .NET MAUI.
  • Elevated performance, reliability, and developer experience for .NET MAUI applications

Moreover, improved quality and significant feature enhancement for ARM64 platform and many other enhancements and improvements. More details about the release can be found here. And .NET 8 release notes can be found here.


Similar Articles