Table of Contents

Class AsyncActionFactory<TTuple>

Namespace
Cuemon.Threading
Assembly
Cuemon.Core.dll

Provides a way of invoking an Action delegate regardless of the amount of parameters provided.

public sealed class AsyncActionFactory<TTuple> : MutableTupleFactory<TTuple> where TTuple : MutableTuple

Type Parameters

TTuple

The type of the n-tuple representation of a MutableTuple.

Inheritance
AsyncActionFactory<TTuple>
Inherited Members

Constructors

AsyncActionFactory(Func<TTuple, CancellationToken, Task>, TTuple)

Initializes a new instance of the AsyncActionFactory<TTuple> class.

public AsyncActionFactory(Func<TTuple, CancellationToken, Task> method, TTuple tuple)

Parameters

method Func<TTuple, CancellationToken, Task>

The Task based function delegate to invoke.

tuple TTuple

The n-tuple argument of method.

AsyncActionFactory(Func<TTuple, CancellationToken, Task>, TTuple, Delegate)

Initializes a new instance of the AsyncActionFactory<TTuple> class.

public AsyncActionFactory(Func<TTuple, CancellationToken, Task> method, TTuple tuple, Delegate originalDelegate)

Parameters

method Func<TTuple, CancellationToken, Task>

The Task based function delegate to invoke.

tuple TTuple

The n-tuple argument of method.

originalDelegate Delegate

The original delegate wrapped by method.

Methods

Clone()

Creates a shallow copy of the current AsyncActionFactory<TTuple> object.

public override MutableTupleFactory<TTuple> Clone()

Returns

MutableTupleFactory<TTuple>

A new AsyncActionFactory<TTuple> that is a copy of this instance.

Remarks

When thread safety is required this is the method to invoke.

ExecuteMethodAsync(CancellationToken)

Executes the delegate associated with this instance.

public Task ExecuteMethodAsync(CancellationToken ct)

Parameters

ct CancellationToken

The token to monitor for cancellation requests. The default value is None.

Returns

Task

A task that represents the asynchronous operation.

Exceptions

InvalidOperationException

No delegate was specified on the factory.

OperationCanceledException

The ct was canceled.