.NET 10 is set to launch in November 2025 as the next LTS release having free support and patches for three years from its release date. Here are three of my favorite new features that I’ll definitely use in my day-to-day work.
Extension Members
I’ve used extension methods extensively since their introduction in C# 3 back in 2007. Now, with C# 14, this concept is being further expanded to include extension members. Before the release of C# 14, an extension method would typically look like this:
public static void Subtract(this int number, int subtractBy)
=> number - subtractBy;
But now, with C# 14 we can define an extension method and extension members like this:
public static class Extensions
{
extension(string sentence)
{
public int CountWords()
=> sentence.Split(' ', StringSplitOptions.RemoveEmptyEntries).Length;
public bool FirstWord
=> sentence.Split(' ', StringSplitOptions.RemoveEmptyEntries).FirstOrDefault() ?? string.Empty;
}
}
TypedResults for Server Sent Events (SSE)
In client-server communication, a pull-based approach is commonly used where the client requests resources via a RESTful API or a similar mechanisms. The issue with this model is that it can generate excessive server traffic when clients repeatedly poll for resources that aren’t yet available.
To address this, we can shift from a pull-based model to a push-based one, where the server notifies the client as soon as the resource becomes available.
ASP.NET Core already offers several options for push-based communication. You can use SignalR, which leverages WebSockets
to notify clients when something happens on the backend. Alternatively, you can use Server-Sent Events (SSE)
for one-way, realtime updates from server to client over HTTP. The only requirement for an HTTP response to be recognized as an event stream is that the Content-Type
header is set to text/event-stream
.
Server Sent Events isn't something new in ASP.NET Core, but with the release of .NET 10 its really easy to implement. When .NET Core 3 was released back in 2019 a new type called IAsyncEnumerable
where introduced. IAsyncEnumerable<T>
is an interface in C# that allows you to iterate over a sequence of data asynchronously without blocking. This interface can now be passed in as a parameter to the new method in TypedResults
:
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.MapGet("/results, (CancellationToken token) =>
{
IAsyncEnumerable<SseItem<Result>> results = GetResults(token);
return TypedResults.ServerSentEvents(results);
});
Validation Support in Minimal APIs
When it comes to validation, ASP.NET offers excellent support through the System.ComponentModel.DataAnnotations
namespace. It includes a wide range of built-in attributes and also allows you to define custom ones.
Until now, validation hasn’t been built into Minimal APIs by default, but this will change with the release of .NET 10. When I say ‘built-in,’ I don’t mean it wasn’t possible before, but it required you to manually implement validation logic within each endpoint or create a custom filter.
Beginning with ASP.NET 10
you can simply write
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddValidation();
var app = builder.Build();
app.MapPatch("/update-email", [EmailAddress] string address) =>
{
....
return TypedResults.Ok();
}
The call to AddValidation
will ensure that all neccessary services to support validation is being registered within the container. Pretty easy!
Those are my top three new features in .NET 10 that I believe will have a real impact on my day-to-day work as a .NET developer. What are yours?