[C# 15-Fundamentals and reference]: New Feature - unions
- Dominant language
- No language data
- Stars
- 4.8k
- Forks
- 6.1k
- Avg merge
- 15h 21m
- Merged PRs (30d)
- 370
Description
### .NET 11 Preview
.NET 11 Preview 3
### Link to speclet
- [Speclet](https://github.com/dotnet/csharplang/blob/main/proposals/unions.md)
### Link to Pull request
- [PR](https://github.com/dotnet/roslyn/pull/82640)
### New behavior
The `union` keyword creates a new type: a union where the member `Value` is an instance of exactly one of the declared union members.
### Language reference tasks
- The `union` keyword defines a new type that is lowered as a `record struct`. A `union` type holds an instance of one of its members.
- Update pattern matching to discuss exhaustiveness and subsumptiom related to unions.
- Update casts to include union casts (implicit and explicit)
### Everyday C# tasks
- Add information about unions for "one of" and "Result" style scenarios.
---
[Associated WorkItem - 562440](https://dev.azure.com/msft-skilling/Content/_workitems/edit/562440)
Contributor guide
Assessment
This issue has not been assessed yet.