Method Match
- Namespace
- SodaFlow.Functional
- Assembly
- SodaFlow.Functional.dll
Match<T, TResult>(Task<Maybe<T>>, Func<T, TResult>, Func<TResult>)
Runs one function on the value that the task gives when there is a value, and a different one, and returns its result.
public static Task<TResult> Match<T, TResult>(this Task<Maybe<T>> a, Func<T, TResult> onSome, Func<TResult> onNone)
Parameters
aTask<Maybe<T>>The task that gives the value for
Match.onSomeFunc<T, TResult>Run with the contained value when there is one.
onNoneFunc<TResult>Run when there is no value.
Returns
- Task<TResult>
A task giving whatever the function that was run returned.
Type Parameters
TThe type of the value, when there is one.
TResultThe type each of the two functions returns.