-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
If you have a type OneOf<T0, T1> where T0 (for example) is non-null value type (like int, or enum) and you deconstruct it then T1 will always get a non-null value.
To achieve the right semantic (where only one of the types should return a non-null value, like the discriminated-union type) you would need to convert T0 to a Nullable<T0>. Unfortunately this can only work value types (where T0: struct), so there's no easy solution that works with all cases.
If you're interested please check my solution here: https://github.com/Drizin/OneOf.DeconstructorExtensions
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels