Class Branch
- Namespace
- Executables
- Assembly
- executables.dll
Factory methods for creating conditional executors.
public static class Branch
- Inheritance
-
Branch
- Inherited Members
Methods
When<T>(Func<bool>, IExecutable<Unit, T>)
Creates a parameterless executor from an executable that runs only when the condition is satisfied.
[Pure]
public static IExecutor<Unit, Optional<T>> When<T>(Func<bool> condition, IExecutable<Unit, T> executable)
Parameters
conditionFunc<bool>Condition that decides whether execution should proceed.
executableIExecutable<Unit, T>Executable to run when the condition is satisfied.
Returns
- IExecutor<Unit, Optional<T>>
Executor that returns an Optional<T> containing the result when executed.
Type Parameters
T
Exceptions
- ArgumentNullException
conditionorexecutableis null.
When<T>(Func<bool>, IExecutor<Unit, Optional<T>>)
Creates a parameterless executor that runs only when the condition is satisfied and flattens an optional result.
[Pure]
public static IExecutor<Unit, Optional<T>> When<T>(Func<bool> condition, IExecutor<Unit, Optional<T>> executor)
Parameters
conditionFunc<bool>Condition that decides whether execution should proceed.
executorIExecutor<Unit, Optional<T>>Executor to run when the condition is satisfied.
Returns
Type Parameters
T
Exceptions
- ArgumentNullException
conditionorexecutoris null.
When<T>(Func<bool>, IExecutor<Unit, T>)
Creates a parameterless executor that runs only when the condition is satisfied.
[Pure]
public static IExecutor<Unit, Optional<T>> When<T>(Func<bool> condition, IExecutor<Unit, T> executor)
Parameters
conditionFunc<bool>Condition that decides whether execution should proceed.
executorIExecutor<Unit, T>Executor to run when the condition is satisfied.
Returns
- IExecutor<Unit, Optional<T>>
Executor that returns an Optional<T> containing the result when executed.
Type Parameters
T
Exceptions
- ArgumentNullException
conditionorexecutoris null.
When<T1, T2>(Func<T1, bool>, IExecutable<T1, T2>)
Creates an executor from an executable that runs only when the condition is satisfied.
[Pure]
public static IExecutor<T1, Optional<T2>> When<T1, T2>(Func<T1, bool> condition, IExecutable<T1, T2> executable)
Parameters
conditionFunc<T1, bool>Condition that decides whether execution should proceed.
executableIExecutable<T1, T2>Executable to run when the condition is satisfied.
Returns
- IExecutor<T1, Optional<T2>>
Executor that returns an Optional<T> containing the result when executed.
Type Parameters
T1T2
Exceptions
- ArgumentNullException
conditionorexecutableis null.
When<T1, T2>(Func<T1, bool>, IExecutor<T1, Optional<T2>>)
Creates an executor that runs only when the condition is satisfied and flattens an optional result.
[Pure]
public static IExecutor<T1, Optional<T2>> When<T1, T2>(Func<T1, bool> condition, IExecutor<T1, Optional<T2>> executor)
Parameters
conditionFunc<T1, bool>Condition that decides whether execution should proceed.
executorIExecutor<T1, Optional<T2>>Executor to run when the condition is satisfied.
Returns
Type Parameters
T1T2
Exceptions
- ArgumentNullException
conditionorexecutoris null.
When<T1, T2>(Func<T1, bool>, IExecutor<T1, T2>)
Creates an executor that runs only when the condition is satisfied.
[Pure]
public static IExecutor<T1, Optional<T2>> When<T1, T2>(Func<T1, bool> condition, IExecutor<T1, T2> executor)
Parameters
conditionFunc<T1, bool>Condition that decides whether execution should proceed.
executorIExecutor<T1, T2>Executor to run when the condition is satisfied.
Returns
- IExecutor<T1, Optional<T2>>
Executor that returns an Optional<T> containing the result when executed.
Type Parameters
T1T2
Exceptions
- ArgumentNullException
conditionorexecutoris null.