Top "Discriminated-union" questions

Discriminated union, or disjoint union, is a data structure used to hold a value that could take on several different, but fixed types.

Discriminated union in C#

[Note: This question had the original title "C (ish) style union in C#" but as Jeff's comment informed me, apparently …

c# type-safety discriminated-union
Kotlin and discriminated unions (sum types)

Does Kotlin have anything like discriminated unions (sum types)? What would be the idiomatic Kotlin translation of this (F#): type …

kotlin algebraic-data-types discriminated-union
Union types in Java

I've been working with C# for a while and trying to get more familiar with Java. So I'm trying to …

java c# kotlin discriminated-union
Constraining type in Typescript generic to be one of several types

I'm trying to constrain the input of a generic to be one of several types. The closest notation I've found …

typescript generics discriminated-union