Table of Contents

Method MatchAsync

Namespace
SodaFlow.Functional
Assembly
SodaFlow.Functional.dll

MatchAsync<T>(Func<object?, Task<T>>, Func<object?, Task<T>>, Func<object?, Task<T>>)

Runs one of the three asynchronous functions depending on which case is held, and returns its result.

Task<T> MatchAsync<T>(Func<object?, Task<T>> onFirst, Func<object?, Task<T>> onSecond, Func<object?, Task<T>> onThird)

Parameters

onFirst Func<object, Task<T>>

Run with the value when the first case is held.

onSecond Func<object, Task<T>>

Run with the value when the second case is held.

onThird Func<object, Task<T>>

Run with the value when the third case is held.

Returns

Task<T>

The task returned by whichever function was run.

Type Parameters

T

The 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.