Class ConditionalExecutorExtensions
- Namespace
- Executables
- Assembly
- executables.dll
Extension methods for building conditional executors.
public static class ConditionalExecutorExtensions
- Inheritance
-
ConditionalExecutorExtensions
- Inherited Members
Methods
OrElse<T1, T2>(IExecutor<T1, Optional<T2>>, IExecutable<T1, T2>)
Supplies a fallback executable when the source executor produces no value.
[Pure]
public static IExecutor<T1, T2> OrElse<T1, T2>(this IExecutor<T1, Optional<T2>> executor, IExecutable<T1, T2> fallback)
Parameters
executorIExecutor<T1, Optional<T2>>Source optional executor.
fallbackIExecutable<T1, T2>Fallback executable.
Returns
- IExecutor<T1, T2>
Executor producing either the original value or the fallback result.
Type Parameters
T1T2
Exceptions
- ArgumentNullException
fallbackis null.
OrElse<T1, T2>(IExecutor<T1, Optional<T2>>, IExecutor<T1, T2>)
Supplies a fallback executor when the source executor produces no value.
[Pure]
public static IExecutor<T1, T2> OrElse<T1, T2>(this IExecutor<T1, Optional<T2>> executor, IExecutor<T1, T2> fallback)
Parameters
executorIExecutor<T1, Optional<T2>>Source optional executor.
fallbackIExecutor<T1, T2>Fallback executor.
Returns
- IExecutor<T1, T2>
Executor producing either the original value or the fallback result.
Type Parameters
T1T2
Exceptions
- ArgumentNullException
fallbackis null.
OrWhen<T>(IExecutor<Unit, Optional<T>>, Func<bool>, IExecutable<Unit, T>)
Adds a parameterless conditional fallback executable executed when the source executor produces no value.
[Pure]
public static IExecutor<Unit, Optional<T>> OrWhen<T>(this IExecutor<Unit, Optional<T>> executor, Func<bool> condition, IExecutable<Unit, T> executable)
Parameters
executorIExecutor<Unit, Optional<T>>Source optional executor.
conditionFunc<bool>Condition evaluated before running fallback logic.
executableIExecutable<Unit, T>Executable to run when the condition is satisfied.
Returns
Type Parameters
T
Exceptions
- ArgumentNullException
conditionorexecutableis null.
OrWhen<T>(IExecutor<Unit, Optional<T>>, Func<bool>, IExecutor<Unit, Optional<T>>)
Adds a parameterless conditional fallback executed when the source executor produces no value and flattens an optional fallback result.
[Pure]
public static IExecutor<Unit, Optional<T>> OrWhen<T>(this IExecutor<Unit, Optional<T>> executor, Func<bool> condition, IExecutor<Unit, Optional<T>> other)
Parameters
executorIExecutor<Unit, Optional<T>>Source optional executor.
conditionFunc<bool>Condition evaluated before running fallback logic.
otherIExecutor<Unit, Optional<T>>Executor to run when the condition is satisfied.
Returns
Type Parameters
T
Exceptions
- ArgumentNullException
conditionorotheris null.
OrWhen<T>(IExecutor<Unit, Optional<T>>, Func<bool>, IExecutor<Unit, T>)
Adds a parameterless conditional fallback executed when the source executor produces no value.
[Pure]
public static IExecutor<Unit, Optional<T>> OrWhen<T>(this IExecutor<Unit, Optional<T>> executor, Func<bool> condition, IExecutor<Unit, T> other)
Parameters
executorIExecutor<Unit, Optional<T>>Source optional executor.
conditionFunc<bool>Condition evaluated before running fallback logic.
otherIExecutor<Unit, T>Executor to run when the condition is satisfied.
Returns
Type Parameters
T
Exceptions
- ArgumentNullException
conditionorotheris null.
OrWhen<T1, T2>(IExecutor<T1, Optional<T2>>, Func<T1, bool>, IExecutable<T1, T2>)
Adds a conditional fallback executable executed when the source executor produces no value.
[Pure]
public static IExecutor<T1, Optional<T2>> OrWhen<T1, T2>(this IExecutor<T1, Optional<T2>> executor, Func<T1, bool> condition, IExecutable<T1, T2> executable)
Parameters
executorIExecutor<T1, Optional<T2>>Source optional executor.
conditionFunc<T1, bool>Condition evaluated against the original input.
executableIExecutable<T1, T2>Executable to run when the condition is satisfied.
Returns
Type Parameters
T1T2
Exceptions
- ArgumentNullException
conditionorexecutableis null.
OrWhen<T1, T2>(IExecutor<T1, Optional<T2>>, Func<T1, bool>, IExecutor<T1, Optional<T2>>)
Adds a conditional fallback executed when the source executor produces no value and flattens an optional fallback result.
[Pure]
public static IExecutor<T1, Optional<T2>> OrWhen<T1, T2>(this IExecutor<T1, Optional<T2>> executor, Func<T1, bool> condition, IExecutor<T1, Optional<T2>> other)
Parameters
executorIExecutor<T1, Optional<T2>>Source optional executor.
conditionFunc<T1, bool>Condition evaluated against the original input.
otherIExecutor<T1, Optional<T2>>Executor to run when the condition is satisfied.
Returns
Type Parameters
T1T2
Exceptions
- ArgumentNullException
conditionorotheris null.
OrWhen<T1, T2>(IExecutor<T1, Optional<T2>>, Func<T1, bool>, IExecutor<T1, T2>)
Adds a conditional fallback executed when the source executor produces no value.
[Pure]
public static IExecutor<T1, Optional<T2>> OrWhen<T1, T2>(this IExecutor<T1, Optional<T2>> executor, Func<T1, bool> condition, IExecutor<T1, T2> other)
Parameters
executorIExecutor<T1, Optional<T2>>Source optional executor.
conditionFunc<T1, bool>Condition evaluated against the original input.
otherIExecutor<T1, T2>Executor to run when the condition is satisfied.
Returns
Type Parameters
T1T2
Exceptions
- ArgumentNullException
conditionorotheris null.