FSharp.Core


Option<'T> Type

The type of optional values. When used from other CLI languages the empty option is the null value.

Use the constructors Some and None to create values of this type. Use the values in the Option module to manipulate values of this type, or pattern match against the values directly. None values will appear as the value null to other CLI languages. Instance methods on this type will appear as static methods to other CLI languages due to the use of null as a value representation.

Union cases

Union case Description

None

Full Usage: None

The representation of "No value"

Some Value

Full Usage: Some Value

Parameters:
    Value : 'T - The input value.

The representation of "Value of type 'T"

Value : 'T

The input value.

Instance members

Instance member Description

this.IsNone

Full Usage: this.IsNone

Returns: bool

Return 'true' if the option is a 'None' value.

Returns: bool

this.IsSome

Full Usage: this.IsSome

Returns: bool

Return 'true' if the option is a 'Some' value.

Returns: bool

this.Value

Full Usage: this.Value

Returns: 'T

Get the value of a 'Some' option. A NullReferenceException is raised if the option is 'None'.

Returns: 'T