Microsoft devs rejoice: Union types coming to C# in November
- ID
- 20933
- Status
- summarized
- Published
- 03 Sep 2026, 4:37 AM
- Fetched
- 03 Sep 2026, 7:51 AM
- Provider
- The Register
- Category
- technology
- Original URL
- https://www.theregister.com/devops/2026/09/02/microsoft-devs-rejoice-union-types-coming-to-c-in-november/5294056
- Source URL
- https://www.theregister.com/headlines.atom
Summary
- Score
- 6.0
- Created
- 03 Sep 2026, 7:53 AM
- Tags
- Audience
- developers
What happened
C# 15, launching November 2026, introduces union types via a new `union` keyword that lets developers group disparate custom types into a single compiler-verified entity, enabling better pattern matching without wrapper classes or third-party libraries. The release also adds `closed` hierarchies that restrict which types can inherit from a base class, giving similar compile-time guarantees to inheritance chains.
Why it matters
If you maintain a C# codebase, plan to evaluate C# 15's union types as a replacement for hand-rolled Result/Either wrappers and discriminated union workarounds you may be using today—Torgersen and Campbell's demo showed a single switch expression replacing what previously needed error boilerplate or external libraries. The `closed` keyword also means you can now enforce sealed inheritance hierarchies at the compiler level, which affects how you design domain models going forward.
Discussion angle
Whether union types in C# 15 meaningfully change how teams should architect domain models and error-handling flows, or if existing pattern-matching improvements in recent C# versions already cover most use cases.