Class AsyncConditionalExecutorExtensions
- Namespace
- Executables
- Assembly
- executables.dll
Extension methods for building conditional asynchronous executors.
public static class AsyncConditionalExecutorExtensions
- Inheritance
-
AsyncConditionalExecutorExtensions
- Inherited Members
Methods
OrElse<T1, T2>(IAsyncExecutor<T1, Optional<T2>>, IAsyncExecutable<T1, T2>)
Supplies an asynchronous fallback executable when the source executor produces no value.
[Pure]
public static IAsyncExecutor<T1, T2> OrElse<T1, T2>(this IAsyncExecutor<T1, Optional<T2>> executor, IAsyncExecutable<T1, T2> fallback)
Parameters
executorIAsyncExecutor<T1, Optional<T2>>Source optional executor.
fallbackIAsyncExecutable<T1, T2>Fallback asynchronous executable.
Returns
- IAsyncExecutor<T1, T2>
Asynchronous executor producing either the original value or the fallback result.
Type Parameters
T1T2
Exceptions
- ArgumentNullException
fallbackis null.
OrElse<T1, T2>(IAsyncExecutor<T1, Optional<T2>>, IAsyncExecutor<T1, T2>)
Supplies an asynchronous fallback executor when the source executor produces no value.
[Pure]
public static IAsyncExecutor<T1, T2> OrElse<T1, T2>(this IAsyncExecutor<T1, Optional<T2>> executor, IAsyncExecutor<T1, T2> fallback)
Parameters
executorIAsyncExecutor<T1, Optional<T2>>Source optional executor.
fallbackIAsyncExecutor<T1, T2>Fallback asynchronous executor.
Returns
- IAsyncExecutor<T1, T2>
Asynchronous executor producing either the original value or the fallback result.
Type Parameters
T1T2
Exceptions
- ArgumentNullException
fallbackis null.
OrWhen<T>(IAsyncExecutor<Unit, Optional<T>>, Func<bool>, IAsyncExecutable<Unit, T>)
Adds a parameterless asynchronous conditional fallback executed with an asynchronous executable when the source executor produces no value.
[Pure]
public static IAsyncExecutor<Unit, Optional<T>> OrWhen<T>(this IAsyncExecutor<Unit, Optional<T>> executor, Func<bool> condition, IAsyncExecutable<Unit, T> executable)
Parameters
executorIAsyncExecutor<Unit, Optional<T>>Source optional executor.
conditionFunc<bool>Condition evaluated against the original input.
executableIAsyncExecutable<Unit, T>Asynchronous executable to run when the condition is satisfied.
Returns
- IAsyncExecutor<Unit, Optional<T>>
Asynchronous executor producing the original or fallback optional result.
Type Parameters
T
Exceptions
- ArgumentNullException
conditionorexecutableis null.
OrWhen<T>(IAsyncExecutor<Unit, Optional<T>>, Func<bool>, IAsyncExecutor<Unit, Optional<T>>)
Adds a parameterless asynchronous conditional fallback executed when the source executor produces no value and flattens an optional fallback result.
[Pure]
public static IAsyncExecutor<Unit, Optional<T>> OrWhen<T>(this IAsyncExecutor<Unit, Optional<T>> executor, Func<bool> condition, IAsyncExecutor<Unit, Optional<T>> other)
Parameters
executorIAsyncExecutor<Unit, Optional<T>>Source optional executor.
conditionFunc<bool>Condition evaluated against the original input.
otherIAsyncExecutor<Unit, Optional<T>>Asynchronous executor to run when the condition is satisfied.
Returns
- IAsyncExecutor<Unit, Optional<T>>
Asynchronous executor producing the original or fallback optional result.
Type Parameters
T
Exceptions
- ArgumentNullException
conditionorotheris null.
OrWhen<T>(IAsyncExecutor<Unit, Optional<T>>, Func<bool>, IAsyncExecutor<Unit, T>)
Adds a parameterless asynchronous conditional fallback executed when the source executor produces no value.
[Pure]
public static IAsyncExecutor<Unit, Optional<T>> OrWhen<T>(this IAsyncExecutor<Unit, Optional<T>> executor, Func<bool> condition, IAsyncExecutor<Unit, T> other)
Parameters
executorIAsyncExecutor<Unit, Optional<T>>Source optional executor.
conditionFunc<bool>Condition evaluated against the original input.
otherIAsyncExecutor<Unit, T>Asynchronous executor to run when the condition is satisfied.
Returns
- IAsyncExecutor<Unit, Optional<T>>
Asynchronous executor producing the original or fallback optional result.
Type Parameters
T
Exceptions
- ArgumentNullException
conditionorotheris null.
OrWhen<T1, T2>(IAsyncExecutor<T1, Optional<T2>>, Func<T1, bool>, IAsyncExecutable<T1, T2>)
Adds an asynchronous conditional fallback executed with an asynchronous executable when the source executor produces no value.
[Pure]
public static IAsyncExecutor<T1, Optional<T2>> OrWhen<T1, T2>(this IAsyncExecutor<T1, Optional<T2>> executor, Func<T1, bool> condition, IAsyncExecutable<T1, T2> executable)
Parameters
executorIAsyncExecutor<T1, Optional<T2>>Source optional executor.
conditionFunc<T1, bool>Condition evaluated against the original input.
executableIAsyncExecutable<T1, T2>Asynchronous executable to run when the condition is satisfied.
Returns
- IAsyncExecutor<T1, Optional<T2>>
Asynchronous executor producing the original or fallback optional result.
Type Parameters
T1T2
Exceptions
- ArgumentNullException
conditionorexecutableis null.
OrWhen<T1, T2>(IAsyncExecutor<T1, Optional<T2>>, Func<T1, bool>, IAsyncExecutor<T1, Optional<T2>>)
Adds an asynchronous conditional fallback executed when the source executor produces no value and flattens an optional fallback result.
[Pure]
public static IAsyncExecutor<T1, Optional<T2>> OrWhen<T1, T2>(this IAsyncExecutor<T1, Optional<T2>> executor, Func<T1, bool> condition, IAsyncExecutor<T1, Optional<T2>> other)
Parameters
executorIAsyncExecutor<T1, Optional<T2>>Source optional executor.
conditionFunc<T1, bool>Condition evaluated against the original input.
otherIAsyncExecutor<T1, Optional<T2>>Asynchronous executor to run when the condition is satisfied.
Returns
- IAsyncExecutor<T1, Optional<T2>>
Asynchronous executor producing the original or fallback optional result.
Type Parameters
T1T2
Exceptions
- ArgumentNullException
conditionorotheris null.
OrWhen<T1, T2>(IAsyncExecutor<T1, Optional<T2>>, Func<T1, bool>, IAsyncExecutor<T1, T2>)
Adds an asynchronous conditional fallback executed when the source executor produces no value.
[Pure]
public static IAsyncExecutor<T1, Optional<T2>> OrWhen<T1, T2>(this IAsyncExecutor<T1, Optional<T2>> executor, Func<T1, bool> condition, IAsyncExecutor<T1, T2> other)
Parameters
executorIAsyncExecutor<T1, Optional<T2>>Source optional executor.
conditionFunc<T1, bool>Condition evaluated against the original input.
otherIAsyncExecutor<T1, T2>Asynchronous executor to run when the condition is satisfied.
Returns
- IAsyncExecutor<T1, Optional<T2>>
Asynchronous executor producing the original or fallback optional result.
Type Parameters
T1T2
Exceptions
- ArgumentNullException
conditionorotheris null.