Table of Contents

Class AsyncExecutable

Namespace
Executables
Assembly
executables.dll

Factory methods for creating asynchronous executables.

public static class AsyncExecutable
Inheritance
AsyncExecutable
Inherited Members

Methods

Accumulate<T1, T2>(AsyncFunc<T1, T2>)

Creates an asynchronous executable that preserves its input and appends a computed value.

[Pure]
public static IAsyncExecutable<T1, (T1, T2)> Accumulate<T1, T2>(AsyncFunc<T1, T2> func)

Parameters

func AsyncFunc<T1, T2>

Asynchronous delegate that computes an additional value from the input.

Returns

IAsyncExecutable<T1, (T1, T2)>

Asynchronous executable that returns both the original input and the computed value.

Type Parameters

T1
T2

Exceptions

ArgumentNullException

func is null.

Create(AsyncAction)

Creates an async executable from a parameterless async action.

[Pure]
public static IAsyncExecutable<Unit, Unit> Create(AsyncAction action)

Parameters

action AsyncAction

Async action used for execution.

Returns

IAsyncExecutable<Unit, Unit>

Exceptions

ArgumentNullException

action is null.

Create<T>(AsyncAction<T>)

Creates an async executable from an async action.

[Pure]
public static IAsyncExecutable<T, Unit> Create<T>(AsyncAction<T> action)

Parameters

action AsyncAction<T>

Async action used for execution.

Returns

IAsyncExecutable<T, Unit>

Type Parameters

T

Exceptions

ArgumentNullException

action is null.

Create<T>(AsyncFunc<T>)

Creates an async executable from a parameterless async function.

[Pure]
public static IAsyncExecutable<Unit, T> Create<T>(AsyncFunc<T> func)

Parameters

func AsyncFunc<T>

Async function used for execution.

Returns

IAsyncExecutable<Unit, T>

Type Parameters

T

Exceptions

ArgumentNullException

func is null.

Create<T1, T2>(AsyncAction<T1, T2>)

Creates an async executable from an async action with two arguments.

[Pure]
public static IAsyncExecutable<(T1, T2), Unit> Create<T1, T2>(AsyncAction<T1, T2> action)

Parameters

action AsyncAction<T1, T2>

Async action used for execution.

Returns

IAsyncExecutable<(T1, T2), Unit>

Async executable that accepts a 2-tuple input and returns Unit.

Type Parameters

T1
T2

Exceptions

ArgumentNullException

action is null.

Create<T1, T2>(AsyncFunc<T1, T2>)

Creates an async executable from an async function.

[Pure]
public static IAsyncExecutable<T1, T2> Create<T1, T2>(AsyncFunc<T1, T2> func)

Parameters

func AsyncFunc<T1, T2>

Async function used for execution.

Returns

IAsyncExecutable<T1, T2>

Type Parameters

T1
T2

Exceptions

ArgumentNullException

func is null.

Create<T1, T2, T3>(AsyncAction<T1, T2, T3>)

Creates an async executable from an async action with three arguments.

[Pure]
public static IAsyncExecutable<(T1, T2, T3), Unit> Create<T1, T2, T3>(AsyncAction<T1, T2, T3> action)

Parameters

action AsyncAction<T1, T2, T3>

Async action used for execution.

Returns

IAsyncExecutable<(T1, T2, T3), Unit>

Async executable that accepts a 3-tuple input and returns Unit.

Type Parameters

T1
T2
T3

Exceptions

ArgumentNullException

action is null.

Create<T1, T2, T3>(AsyncFunc<T1, T2, T3>)

Creates an async executable from an async function with two arguments.

[Pure]
public static IAsyncExecutable<(T1, T2), T3> Create<T1, T2, T3>(AsyncFunc<T1, T2, T3> func)

Parameters

func AsyncFunc<T1, T2, T3>

Async function used for execution.

Returns

IAsyncExecutable<(T1, T2), T3>

Async executable that accepts a 2-tuple input and returns function result.

Type Parameters

T1
T2
T3

Exceptions

ArgumentNullException

func is null.

Create<T1, T2, T3, T4>(AsyncAction<T1, T2, T3, T4>)

Creates an async executable from an async action with four arguments.

[Pure]
public static IAsyncExecutable<(T1, T2, T3, T4), Unit> Create<T1, T2, T3, T4>(AsyncAction<T1, T2, T3, T4> action)

Parameters

action AsyncAction<T1, T2, T3, T4>

Async action used for execution.

Returns

IAsyncExecutable<(T1, T2, T3, T4), Unit>

Async executable that accepts a 4-tuple input and returns Unit.

Type Parameters

T1
T2
T3
T4

Exceptions

ArgumentNullException

action is null.

Create<T1, T2, T3, T4>(AsyncFunc<T1, T2, T3, T4>)

Creates an async executable from an async function with three arguments.

[Pure]
public static IAsyncExecutable<(T1, T2, T3), T4> Create<T1, T2, T3, T4>(AsyncFunc<T1, T2, T3, T4> func)

Parameters

func AsyncFunc<T1, T2, T3, T4>

Async function used for execution.

Returns

IAsyncExecutable<(T1, T2, T3), T4>

Async executable that accepts a 3-tuple input and returns function result.

Type Parameters

T1
T2
T3
T4

Exceptions

ArgumentNullException

func is null.

Create<T1, T2, T3, T4, T5>(AsyncFunc<T1, T2, T3, T4, T5>)

Creates an async executable from an async function with four arguments.

[Pure]
public static IAsyncExecutable<(T1, T2, T3, T4), T5> Create<T1, T2, T3, T4, T5>(AsyncFunc<T1, T2, T3, T4, T5> func)

Parameters

func AsyncFunc<T1, T2, T3, T4, T5>

Async function used for execution.

Returns

IAsyncExecutable<(T1, T2, T3, T4), T5>

Async executable that accepts a 4-tuple input and returns function result.

Type Parameters

T1
T2
T3
T4
T5

Exceptions

ArgumentNullException

func is null.

FlatMap<T1, T2>(AsyncFunc<T1, IAsyncExecutable<T1, T2>>)

Creates a flattened asynchronous executable from an asynchronous delegate that selects the next executable to run.

[Pure]
public static IAsyncExecutable<T1, T2> FlatMap<T1, T2>(AsyncFunc<T1, IAsyncExecutable<T1, T2>> func)

Parameters

func AsyncFunc<T1, IAsyncExecutable<T1, T2>>

Asynchronous delegate that returns the next executable for the provided input.

Returns

IAsyncExecutable<T1, T2>

Asynchronous executable that executes the returned executable and exposes its result directly.

Type Parameters

T1
T2

Exceptions

ArgumentNullException

func is null.

FlatMap<T1, T2>(IAsyncExecutable<T1, IAsyncExecutable<T1, T2>>)

Flattens an asynchronous executable that returns another asynchronous executable into a single executable.

[Pure]
public static IAsyncExecutable<T1, T2> FlatMap<T1, T2>(IAsyncExecutable<T1, IAsyncExecutable<T1, T2>> executable)

Parameters

executable IAsyncExecutable<T1, IAsyncExecutable<T1, T2>>

Executable that returns the next executable to run for the same input.

Returns

IAsyncExecutable<T1, T2>

Asynchronous executable that executes the returned executable and exposes its result directly.

Type Parameters

T1
T2

Exceptions

ArgumentNullException

executable is null.

FlatMap<T1, T2>(Func<T1, IAsyncExecutable<T1, T2>>)

Creates a flattened asynchronous executable from a delegate that selects the next executable to run.

[Pure]
public static IAsyncExecutable<T1, T2> FlatMap<T1, T2>(Func<T1, IAsyncExecutable<T1, T2>> func)

Parameters

func Func<T1, IAsyncExecutable<T1, T2>>

Delegate that returns the next executable for the provided input.

Returns

IAsyncExecutable<T1, T2>

Asynchronous executable that executes the returned executable and exposes its result directly.

Type Parameters

T1
T2

Exceptions

ArgumentNullException

func is null.

Fork<T1, T2, T3>(AsyncFunc<T1, T2>, AsyncFunc<T1, T3>)

Creates an asynchronous executable that runs two asynchronous delegates for the same input and returns both results.

[Pure]
public static IAsyncExecutable<T1, (T2, T3)> Fork<T1, T2, T3>(AsyncFunc<T1, T2> first, AsyncFunc<T1, T3> second)

Parameters

first AsyncFunc<T1, T2>

First asynchronous delegate branch.

second AsyncFunc<T1, T3>

Second asynchronous delegate branch.

Returns

IAsyncExecutable<T1, (T2, T3)>

Asynchronous executable that returns the results of both branches as a tuple.

Type Parameters

T1
T2
T3

Exceptions

ArgumentNullException

first or second is null.

Fork<T1, T2, T3>(IAsyncExecutable<T1, T2>, IAsyncExecutable<T1, T3>)

Creates an asynchronous executable that runs two asynchronous executables for the same input and returns both results.

[Pure]
public static IAsyncExecutable<T1, (T2, T3)> Fork<T1, T2, T3>(IAsyncExecutable<T1, T2> first, IAsyncExecutable<T1, T3> second)

Parameters

first IAsyncExecutable<T1, T2>

First executable branch.

second IAsyncExecutable<T1, T3>

Second executable branch.

Returns

IAsyncExecutable<T1, (T2, T3)>

Asynchronous executable that returns the results of both branches as a tuple.

Type Parameters

T1
T2
T3

Exceptions

ArgumentNullException

first or second is null.

Identity()

Returns a parameterless asynchronous executable that returns Unit unchanged.

[Pure]
public static IAsyncExecutable<Unit, Unit> Identity()

Returns

IAsyncExecutable<Unit, Unit>

Asynchronous identity executable for Unit.

Identity<T>()

Returns an asynchronous executable that returns its input unchanged.

[Pure]
public static IAsyncExecutable<T, T> Identity<T>()

Returns

IAsyncExecutable<T, T>

Asynchronous identity executable.

Type Parameters

T

Race(params AsyncAction[])

Creates a parameterless executable that completes with the first finished action.

[Pure]
public static IAsyncExecutable<Unit, Unit> Race(params AsyncAction[] actions)

Parameters

actions AsyncAction[]

Actions participating in the race.

Returns

IAsyncExecutable<Unit, Unit>

Executable representing the race.

Exceptions

ArgumentNullException

actions is null.

ArgumentException

actions is empty.

RaceSuccess(params AsyncAction[])

Creates a parameterless executable that completes with the first successfully finished action.

[Pure]
public static IAsyncExecutable<Unit, Unit> RaceSuccess(params AsyncAction[] actions)

Parameters

actions AsyncAction[]

Actions participating in the success race.

Returns

IAsyncExecutable<Unit, Unit>

Executable representing the success race.

Exceptions

ArgumentNullException

actions is null.

ArgumentException

actions is empty.

RaceSuccess<T>(params AsyncAction<T>[])

Creates an executable that completes with the first successfully finished action.

[Pure]
public static IAsyncExecutable<T, Unit> RaceSuccess<T>(params AsyncAction<T>[] actions)

Parameters

actions AsyncAction<T>[]

Actions participating in the success race.

Returns

IAsyncExecutable<T, Unit>

Executable representing the success race.

Type Parameters

T

Exceptions

ArgumentNullException

actions is null.

ArgumentException

actions is empty.

RaceSuccess<T>(params AsyncFunc<T>[])

Creates a parameterless executable that completes with the first successfully finished delegate.

[Pure]
public static IAsyncExecutable<Unit, T> RaceSuccess<T>(params AsyncFunc<T>[] functions)

Parameters

functions AsyncFunc<T>[]

Delegates participating in the success race.

Returns

IAsyncExecutable<Unit, T>

Executable representing the success race.

Type Parameters

T

Exceptions

ArgumentNullException

functions is null.

ArgumentException

functions is empty.

RaceSuccess<T1, T2>(params AsyncFunc<T1, T2>[])

Creates an executable that completes with the first successfully finished delegate.

[Pure]
public static IAsyncExecutable<T1, T2> RaceSuccess<T1, T2>(params AsyncFunc<T1, T2>[] functions)

Parameters

functions AsyncFunc<T1, T2>[]

Delegates participating in the success race.

Returns

IAsyncExecutable<T1, T2>

Executable representing the success race.

Type Parameters

T1
T2

Exceptions

ArgumentNullException

functions is null.

ArgumentException

functions is empty.

RaceSuccess<T1, T2>(params IAsyncExecutable<T1, T2>[])

Creates an executable that completes with the first successfully finished executable.

[Pure]
public static IAsyncExecutable<T1, T2> RaceSuccess<T1, T2>(params IAsyncExecutable<T1, T2>[] executables)

Parameters

executables IAsyncExecutable<T1, T2>[]

Executables participating in the race.

Returns

IAsyncExecutable<T1, T2>

Executable representing the success race.

Type Parameters

T1
T2

Exceptions

ArgumentNullException

executables is null.

ArgumentException

executables is empty.

Race<T>(params AsyncAction<T>[])

Creates an executable that completes with the first finished action.

[Pure]
public static IAsyncExecutable<T, Unit> Race<T>(params AsyncAction<T>[] actions)

Parameters

actions AsyncAction<T>[]

Actions participating in the race.

Returns

IAsyncExecutable<T, Unit>

Executable representing the race.

Type Parameters

T

Exceptions

ArgumentNullException

actions is null.

ArgumentException

actions is empty.

Race<T>(params AsyncFunc<T>[])

Creates a parameterless executable that completes with the first finished delegate.

[Pure]
public static IAsyncExecutable<Unit, T> Race<T>(params AsyncFunc<T>[] functions)

Parameters

functions AsyncFunc<T>[]

Delegates participating in the race.

Returns

IAsyncExecutable<Unit, T>

Executable representing the race.

Type Parameters

T

Exceptions

ArgumentNullException

functions is null.

ArgumentException

functions is empty.

Race<T1, T2>(params AsyncFunc<T1, T2>[])

Creates an executable that completes with the first finished delegate.

[Pure]
public static IAsyncExecutable<T1, T2> Race<T1, T2>(params AsyncFunc<T1, T2>[] functions)

Parameters

functions AsyncFunc<T1, T2>[]

Delegates participating in the race.

Returns

IAsyncExecutable<T1, T2>

Executable representing the race.

Type Parameters

T1
T2

Exceptions

ArgumentNullException

functions is null.

ArgumentException

functions is empty.

Race<T1, T2>(params IAsyncExecutable<T1, T2>[])

Creates an executable that completes with the first finished executable.

[Pure]
public static IAsyncExecutable<T1, T2> Race<T1, T2>(params IAsyncExecutable<T1, T2>[] executables)

Parameters

executables IAsyncExecutable<T1, T2>[]

Executables participating in the race.

Returns

IAsyncExecutable<T1, T2>

Executable representing the race.

Type Parameters

T1
T2

Exceptions

ArgumentNullException

executables is null.

ArgumentException

executables is empty.