Method WhereAsync
- Namespace
- SodaFlow.Functional
- Assembly
- SodaFlow.Functional.dll
WhereAsync<T>(Maybe<T>, Func<T, Task<bool>>)
Keeps the contained value only if it satisfies an asynchronous predicate.
public static Task<Maybe<T>> WhereAsync<T>(this Maybe<T> a, Func<T, Task<bool>> predicate)
Parameters
aMaybe<T>The value to filter.
predicateFunc<T, Task<bool>>Run with the contained value when there is one.
Returns
- Task<Maybe<T>>
A task giving
aif it contained a value which satisfiedpredicate, and a Maybe<T> containing no value otherwise.
Type Parameters
TThe type of the value, when there is one.
WhereAsync<T>(Task<Maybe<T>>, Func<T, Task<bool>>)
Keeps the value the task will give only if it satisfies an asynchronous predicate.
public static Task<Maybe<T>> WhereAsync<T>(this Task<Maybe<T>> a, Func<T, Task<bool>> predicate)
Parameters
aTask<Maybe<T>>The task giving the value to filter.
predicateFunc<T, Task<bool>>Run with the contained value when there is one.
Returns
- Task<Maybe<T>>
A task giving the awaited value if it contained one which satisfied
predicate, and a Maybe<T> containing no value otherwise.
Type Parameters
TThe type of the value, when there is one.