Header menu logo issie

Union Module

Functions and values

Function or value Description

Union.allCases ()

Full Usage: Union.allCases ()

Parameters:
    () : unit

Returns: 'T list
Modifiers: inline
Type parameters: 'T

Every case of a discriminated union all of whose cases are argument-less, in declaration order. Use it for a DU written as an enumeration, so that adding a case cannot leave a list of the cases behind: `allCases () = [Red; Green; Blue]`. Throws on a DU with a case that carries fields, since MakeUnion is given no arguments. `inline` is required, and is what makes this work under Fable as well as .NET: Fable erases reflection unless the type argument is resolved at the call site. The same idiom is what the vendored SimpleJson uses to read and write every .dgm - see TypeInfo.Converter.createFrom.

() : unit
Returns: 'T list

Type something to start searching.