Header menu logo TDesu.FSharp

Union Module

Reflection helpers for F# discriminated unions: the case name a value was built with, and the full set of case names for a union type.

Example

 type Status =
     | Active
     | Suspended of reason: string

 Union.caseName Active                 // "Active"
 Union.caseName (Suspended "abuse")    // "Suspended"
 Union.caseNames<Status> ()      // [| "Active"; "Suspended" |]
type Status = | Active | Suspended of reason: string
Multiple items
val string: value: 'T -> string

--------------------
type string = System.String

Functions and values

Function or value Description

Union.caseName value

Full Usage: Union.caseName value

Parameters:
    value : 'T - The union value to inspect.

Returns: string

The name of the case value was built with.

value : 'T

The union value to inspect.

Returns: string
ArgumentException When 'T is not an F# union.

Union.caseNames ()

Full Usage: Union.caseNames ()

Parameters:
    () : unit

Returns: string[]

Every case name of 'T, in declaration order.

() : unit
Returns: string[]
ArgumentException When 'T is not an F# union.

Type something to start searching.