Table of Contents

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

executor IExecutor<T1, Optional<T2>>

Source optional executor.

fallback IExecutable<T1, T2>

Fallback executable.

Returns

IExecutor<T1, T2>

Executor producing either the original value or the fallback result.

Type Parameters

T1
T2

Exceptions

ArgumentNullException

fallback is 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

executor IExecutor<T1, Optional<T2>>

Source optional executor.

fallback IExecutor<T1, T2>

Fallback executor.

Returns

IExecutor<T1, T2>

Executor producing either the original value or the fallback result.

Type Parameters

T1
T2

Exceptions

ArgumentNullException

fallback is 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

executor IExecutor<Unit, Optional<T>>

Source optional executor.

condition Func<bool>

Condition evaluated before running fallback logic.

executable IExecutable<Unit, T>

Executable to run when the condition is satisfied.

Returns

IExecutor<Unit, Optional<T>>

Executor producing the original or fallback optional result.

Type Parameters

T

Exceptions

ArgumentNullException

condition or executable is 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

executor IExecutor<Unit, Optional<T>>

Source optional executor.

condition Func<bool>

Condition evaluated before running fallback logic.

other IExecutor<Unit, Optional<T>>

Executor to run when the condition is satisfied.

Returns

IExecutor<Unit, Optional<T>>

Executor producing the original or fallback optional result.

Type Parameters

T

Exceptions

ArgumentNullException

condition or other is 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

executor IExecutor<Unit, Optional<T>>

Source optional executor.

condition Func<bool>

Condition evaluated before running fallback logic.

other IExecutor<Unit, T>

Executor to run when the condition is satisfied.

Returns

IExecutor<Unit, Optional<T>>

Executor producing the original or fallback optional result.

Type Parameters

T

Exceptions

ArgumentNullException

condition or other is 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

executor IExecutor<T1, Optional<T2>>

Source optional executor.

condition Func<T1, bool>

Condition evaluated against the original input.

executable IExecutable<T1, T2>

Executable to run when the condition is satisfied.

Returns

IExecutor<T1, Optional<T2>>

Executor producing the original or fallback optional result.

Type Parameters

T1
T2

Exceptions

ArgumentNullException

condition or executable is 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

executor IExecutor<T1, Optional<T2>>

Source optional executor.

condition Func<T1, bool>

Condition evaluated against the original input.

other IExecutor<T1, Optional<T2>>

Executor to run when the condition is satisfied.

Returns

IExecutor<T1, Optional<T2>>

Executor producing the original or fallback optional result.

Type Parameters

T1
T2

Exceptions

ArgumentNullException

condition or other is 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

executor IExecutor<T1, Optional<T2>>

Source optional executor.

condition Func<T1, bool>

Condition evaluated against the original input.

other IExecutor<T1, T2>

Executor to run when the condition is satisfied.

Returns

IExecutor<T1, Optional<T2>>

Executor producing the original or fallback optional result.

Type Parameters

T1
T2

Exceptions

ArgumentNullException

condition or other is null.