Method Match
- Namespace
- SodaFlow.Functional
- Assembly
- SodaFlow.Functional.dll
Match<TResult>(Func<T, TResult>, Func<TResult>)
Runs one function when there is a value, and a different one when there is none.
public TResult Match<TResult>(Func<T, TResult> onSome, Func<TResult> onNone)
Parameters
onSomeFunc<T, TResult>Run with the contained value when there is one.
onNoneFunc<TResult>Run when there is no value.
Returns
- TResult
Whatever the function that was run returned.
Type Parameters
TResultThe type each of the two functions returns.
Remarks
This is the only member that reads the contained value, and it expresses each other member here. This calls one function of the two, before this method returns.