Table of Contents

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

a Maybe<T>

The value to filter.

predicate Func<T, Task<bool>>

Run with the contained value when there is one.

Returns

Task<Maybe<T>>

A task giving a if it contained a value which satisfied predicate, and a Maybe<T> containing no value otherwise.

Type Parameters

T

The 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

a Task<Maybe<T>>

The task giving the value to filter.

predicate Func<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

T

The type of the value, when there is one.