.NET 11 and C# 15 will be released tomorrow.
And C# finally gets the feature developers have asked for over a decade 👇
.NET 11 is a Standard-Term Support (STS) release.
STS releases now get 24 months of support, so .NET 11 is supported until November 2028.
Here are 2 features I'm most excited about.
👉 𝗨𝗻𝗶𝗼𝗻 𝗧𝘆𝗽𝗲𝘀
A union says a value is exactly one of a fixed set of types:
public union PaymentMethod(CreditCard, PayPal, BankTransfer);
The case types don't need a common base class.
The compiler checks that your switch expression handles every case. You don't need a default branch.
Add a 4th payment method later → every switch that misses it gets a compiler warning.
Before C# 15, you had 3 weak options:
• object, which accepts anything
• A marker interface or base class, which anyone can extend
• A 3rd party library that emulates unions
👉 𝗥𝘂𝗻𝘁𝗶𝗺𝗲 𝗔𝘀𝘆𝗻𝗰
Since C# 5, the compiler has turned every async method into a hidden state machine class. And you paid in latency and garbage collection for each async-await call.
In .NET 11, the runtime handles async by itself.
According to Microsoft's .NET 11 performance post:
→ Live stack traces: 13 frames → 5 frames
→ Sync completion: 21.2 ns and 144 B → 6.2 ns and 0 B
→ Exceptions through 30 async layers: 51.3 μs → 10.7 μs
The best part: the .NET libraries are already compiled with Runtime Async.
So part of the speed-up comes for free in every .NET 11 app.
Tomorrow, I'll share with 28,000+ developers:
→ What's New in .NET 11
→ What's New in C# 15
→ What's New in .NET 11 Libraries
→ What's New in ASP .NET Core 11
→ What's New in EF Core 11
→ Breaking changes to check before you upgrade
📌 Subscribe to my weekly newsletter to get it first:
↳ https://t.co/jZVrU0xYhM