Method MatchAsync
- Namespace
- SodaFlow.Functional
- Assembly
- SodaFlow.Functional.dll
MatchAsync<T>(Func<T1, Task<T>>, Func<T2, Task<T>>, Func<T3, Task<T>>, Func<T4, Task<T>>, Func<T5, Task<T>>, Func<T6, Task<T>>, Func<T7, Task<T>>, Func<T8, Task<T>>)
Runs one of the eight asynchronous functions depending on which case is held, and returns its result.
public Task<T> MatchAsync<T>(Func<T1, Task<T>> onFirst, Func<T2, Task<T>> onSecond, Func<T3, Task<T>> onThird, Func<T4, Task<T>> onFourth, Func<T5, Task<T>> onFifth, Func<T6, Task<T>> onSixth, Func<T7, Task<T>> onSeventh, Func<T8, Task<T>> onEighth)
Parameters
onFirstFunc<T1, Task<T>>Run with the value when the first case is held.
onSecondFunc<T2, Task<T>>Run with the value when the second case is held.
onThirdFunc<T3, Task<T>>Run with the value when the third case is held.
onFourthFunc<T4, Task<T>>Run with the value when the fourth case is held.
onFifthFunc<T5, Task<T>>Run with the value when the fifth case is held.
onSixthFunc<T6, Task<T>>Run with the value when the sixth case is held.
onSeventhFunc<T7, Task<T>>Run with the value when the seventh case is held.
onEighthFunc<T8, Task<T>>Run with the value when the eighth case is held.
Returns
- Task<T>
The task returned by whichever function was run.
Type Parameters
TThe type each of the functions produces.
Remarks
Only the selected function runs. The task from this call is its task, and not a wrapper. Thus, a failure shows as a fault on that task, and not as an exception from this call.