← All stories
● Covered by 1 source · 1 reportMedium impact1 neutral

C# 15 Preview Introduces Union Types, Closed Hierarchies, and Updated Unsafe Model

🔄 Updated 1h ago
New to BrevFeed? We gather this story from every outlet covering it into one summary — ranked by real-world impact, not just the latest headline — so you never miss what matters. What is BrevFeed? →

Key points

  • C# 15 will ship with .NET 11 in November.
  • Preview 7 of .NET 11 includes C# 15 features.
  • New features include union types and closed hierarchies.
  • An updated unsafe model is also in preview.

C# 15 Features Available in .NET 11 Preview

C# 15 is scheduled for release alongside .NET 11 in November. Developers can now explore its new features through .NET 11 preview 7. Key additions include union types, closed hierarchies, an initial preview of an updated unsafe model, collection expression arguments, extension indexers, and labeled break and continue statements.

Introduction to Union Types

Union types allow developers to explicitly define the exact set of types a value can hold within the type system. Unlike object, marker interfaces, or abstract base classes, which permit any derived or implementing type at runtime, union types constrain values to a specified set of case types that are not necessarily related by inheritance. This provides more precise type control and enables exhaustive switch expressions without a discard or default arm, as the compiler knows the complete set of possibilities.

Closed Hierarchies for Controlled Inheritance

Closed hierarchies extend the concept of explicit type definition to class hierarchies. Applying the 'closed' modifier to a class makes it implicitly abstract and restricts its direct derived types to the declaring assembly. This allows developers to declare precisely which subtypes are permitted, rather than leaving derivation open-ended. This feature, along with union types and planned closed enums, aims to express the allowed set of shapes directly within the type system.

Impact on Type System Design

The introduction of union types and closed hierarchies represents a broader design philosophy in C# 15: making the allowed set of types explicit. These features provide developers with more robust tools for defining and enforcing type constraints, leading to more predictable and maintainable codebases. The updated unsafe model also signals ongoing evolution in how C# handles low-level operations.

✨ This summary was generated by AI from the outlets' reporting listed below. It is not independently verified and may contain errors — check the original sources. How BrevFeed works →

The daily brief

One email each morning: the day's tech stories, clustered across outlets and summarized. No account needed.

One email a day. Unsubscribe in one click, any time.

Today's brief

Spend a few minutes, get the whole day. Every topic's top stories in one hands-free rundown — listen, watch, or read the transcript.

~7 min · 6 stories · Aug 24

▶ Play today's brief Listen on Spotify

New every morning, and the back catalogue is archived by date.

Primary sources

GitHub dotnet/csharplang

Reporting from

C# 15, set to release with .NET 11 in November, is now available in .NET 11 preview 7, introducing features like union types, closed hierarchies, and an updated unsafe model. These additions enhance type system expressiveness and control over inheritance, impacting how developers define and manage data structures.