OptionalValueModule Methods |
The OptionalValueModule type exposes the following members.
Name | Description | |
---|---|---|
|Missing|Present|T |
Complete active pattern that can be used to pattern match on `OptionalValue<T>`.
For example:
let optVal = OptionalValue(42)
match optVal with
| OptionalValue.Missing -> printfn "Empty"
| OptionalValue.Present(v) -> printfn "Contains %d" v
| |
asOptionT |
Turns the `OptionalValue<T>` into a corresponding standard F# `option<T>` value
| |
BindT, R |
If the `OptionalValue<T>` does not contain a value, then returns a new
`OptionalValue<R>.Empty`. Otherwise, returns the result of applying the
function `f` to the value contained in the provided optional value.
| |
defaultArgT |
Returns the value `def` when the argument is missing, otherwise returns its value
| |
getT |
Get the value stored in the specified optional value. If a value is not
available, throws an exception. (This is equivalent to the `Value` property)
| |
MapT, R |
If the `OptionalValue<T>` does not contain a value, then returns a new
`OptionalValue<R>.Empty`. Otherwise, returns the result `OptionalValue<R>`
containing the result of applying the function `f` to the value contained
in the provided optional value.
| |
Map2T1, T2, R |
If both of the arguments contain value, apply the specified function to their
values and return `OptionalValue<R>` with the result. Otherwise return
`OptionalValue.Missing`.
| |
OfNullableT |
Creates `OptionalValue<T>` from a .NET `Nullable<T>` type.
| |
ofOptionT |
Turns a standard F# `option<T>` value into a corresponding `OptionalValue<T>`
| |
OfTupleT |
Creates `OptionalValue<T>` from a tuple of type `bool * 'T`. This function
can be used with .NET methods that use `out` arguments. For example:
Int32.TryParse("42") |> OptionalValue.ofTuple
|