| title | Core.Option Module (F#) |
|---|---|
| description | Core.Option Module (F#) |
| keywords | visual f#, f#, functional programming |
| author | dend |
| manager | danielfe |
| ms.date | 05/16/2016 |
| ms.topic | language-reference |
| ms.prod | visual-studio-dev14 |
| ms.technology | devlang-fsharp |
| ms.assetid | 9e26ddb2-3726-4e9a-8d4c-b121ae775e84 |
Basic operations on options.
Namespace/Module Path: Microsoft.FSharp.Core
Assembly: FSharp.Core (in FSharp.Core.dll)
module OptionFor an overview of options in F#, see Options (F#).
| 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. |
| filter :('T -> bool) -> 'T option -> 'T option |
Evaluates whether the value contained in the option should remain, or be filtered out. |
| 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. |
| toNullable : 'T option -> Nullable<'T> |
Convert the option to a Nullable value. |
Windows 8, Windows 7, Windows Server 2012, Windows Server 2008 R2
F# Core Library Versions
Supported in: 2.0, 4.0, Portable