Apply
Creates a new Option<T>
whose value is the result of applying the given applying
function to Option<T>.Some
value when both applying
and option
are IsSome
.
Otherwise returns an Option<T>.None()
.
Parameters
Returns
Option<Func<T, TResult>> applying
Option<T> option
Option<TResult>
Usage
This function is usually used to modify an option value by using an option function.
It works like a Map
function, but in this case both value and the function are option values.
It's possible to use Apply
function with two different syntaxes.
Apply<T, TResult>(function)
: in this case thefunction
can be a regular function;Apply(optionFunction)
: in this case thefunction
needs to be a option function.
Expliciting an optional function
Using a regular function
When the option function IsNone
When the option value IsNone
Last updated
Was this helpful?