Поделиться через


Core.Option Module (F#)

Basic operations on options.

Namespace/Module Path: Microsoft.FSharp.Core

Assembly: FSharp.Core (in FSharp.Core.dll)

module Option

Remarks

For an overview of options in F#, see Options (F#).

Values

Value

Description

bind : ('T -> 'U option) -> 'T option -> 'U option

Invokes a function on an optional value that itself yields an option.

count : 'T option -> int

Evaluates the equivalent of Set.count for an option.

exists : ('T -> bool) -> 'T option -> bool

Evaluates the equivalent of List.exists for an option.

fold : ('State -> 'T -> 'State) -> 'State -> 'T option -> 'State

Evaluates the equivalent of List.fold for an option.

foldBack : ('T -> 'State -> 'State) -> 'T option -> 'State -> 'State

Performs the equivalent of the List.foldBack operation on an option.

forall : ('T -> bool) -> 'T option -> bool

Evaluates the equivalent of List.forall for an option type.

get : 'T option -> 'T

Gets the value associated with the option.

isNone : 'T option -> bool

Returns true if the option is None.

isSome : 'T option -> bool

Returns true if the option is not None.

iter : ('T -> unit) -> 'T option -> unit

Executes a function for an option value.

map : ('T -> 'U) -> 'T option -> 'U option

Transforms an option value by using a specified mapping function.

toArray : 'T option -> 'T []

Convert the option to an array of length 0 or 1.

toList : 'T option -> 'T list

Convert the option to a list of length 0 or 1.

Platforms

Windows 7, Windows Vista SP2, Windows XP SP3, Windows XP x64 SP2, Windows Server 2008 R2, Windows Server 2008 SP2, Windows Server 2003 SP2

Version Information

F# Runtime

Supported in: 2.0, 4.0

Silverlight

Supported in: 3

See Also

Reference

Microsoft.FSharp.Core Namespace (F#)