Type of issue
Other (describe below)
Description
The OneOrMore example is didactically wrong.
It is not implementing “one or more elements” because the second case can easily hold zero to more elements. Therefore one should use a record type (product) for “one or more” not a union type (sum)
Page URL
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/union
Content source URL
https://github.com/dotnet/docs/blob/main/docs/csharp/language-reference/builtin-types/union.md
Document Version Independent Id
39218c8d-5d3f-ad57-b214-1b2862296ebf
Platform Id
82841458-14a2-7ffb-b31d-a83c2619c5cc
Article author
@BillWagner
Metadata
- ID: 0cb4f7b9-7f0a-7e05-327c-e9c3ee03221a
- PlatformId: 82841458-14a2-7ffb-b31d-a83c2619c5cc
- Service: dotnet-csharp
- Sub-service: lang-reference
Related Issues
Associated WorkItem - 575820
Type of issue
Other (describe below)
Description
The OneOrMore example is didactically wrong.
It is not implementing “one or more elements” because the second case can easily hold zero to more elements. Therefore one should use a record type (product) for “one or more” not a union type (sum)
Page URL
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/union
Content source URL
https://github.com/dotnet/docs/blob/main/docs/csharp/language-reference/builtin-types/union.md
Document Version Independent Id
39218c8d-5d3f-ad57-b214-1b2862296ebf
Platform Id
82841458-14a2-7ffb-b31d-a83c2619c5cc
Article author
@BillWagner
Metadata
Related Issues
Associated WorkItem - 575820