Skip to content
InfoQ·

🚀.NET 11 Preview 7 Released With Major C# and ASP.NET Core Updates

C# Gets Break/Continue Naming And Exhaustive Switches

TL;DR

.NET 11 Preview 7 introduces significant changes to C#, including named break and continue statements, union types with try-both approach, and enhanced switch-expressions. ASP.NET Core gains new features like cache views and interactive server circuits.

Microsoft just dropped .NET 11 Preview 7, packing in major updates for C# and ASP.NET Core. The big news is that break and continue statements can now name an enclosing loop or switch, making your code cleaner and more readable. Plus, union types use a try-both approach to resolve ambiguous situations. If you're working with generic parameters constrained to closed types, the new exhaustiveness in switch-expressions will make your life easier. For ASP.NET Core users, there's a CacheView component that caches rendered output of server-side subtrees and Interactive Server circuits can pause themselves when a browser tab is hidden. This release also includes five new Blazor analyzers for common mistakes and built-in validation message localization.

.NET 11 Preview 7 Released With Major C# and ASP.NET Core Updates — InfoQ

Key Points

1

C# now supports naming enclosing loops or switches for break and continue statements, improving readability (Preview 7 release).

2

Union types use a try-both approach to resolve ambiguous situations, enhancing type safety (Preview 7 release).

3

Switch-expression exhaustiveness understands generic parameters constrained to closed types, simplifying complex logic (Preview 7 release).

4

ASP.NET Core introduces CacheView component caching rendered output of server-side subtrees for performance gains (Preview 7 release).

5

Five new Blazor analyzers are available by default in ASP.NET Core to flag common mistakes and improve code quality (Preview 7 release)

Why It Matters

If you're working with C# or ASP.NET Core, the new features in .NET 11 Preview 7 will streamline your development process. Named break/continue statements make complex loops more readable, while union types' try-both approach simplifies type handling. The CacheView component and interactive server circuits can significantly improve performance for dynamic web applications.

C#ASP.NET CoreCacheViewBlazorSwitch-Expressions

Frequently Asked Questions

Why does this matter?

If you're working with C# or ASP.NET Core, the new features in .NET 11 Preview 7 will streamline your development process. Named break/continue statements make complex loops more readable, while union types' try-both approach simplifies type handling. The CacheView component and interactive server circuits can significantly improve performance for dynamic web applications.

What happened?

.NET 11 Preview 7 introduces significant changes to C#, including named break and continue statements, union types with try-both approach, and enhanced switch-expressions. ASP.NET Core gains new features like cache views and interactive server circuits.

Comments

Subscribe to join the conversation...

Be the first to comment

Enjoyed this article?

Get it daily. 7am. Free. Reads in 5 minutes.

Join 3,194 builders reading daily.

Also get