Table of Contents

Class TaskActionFactory<TTuple>

Namespace
Cuemon
Assembly
Cuemon.Core.dll

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

public sealed class TaskActionFactory<TTuple> : TemplateFactory<TTuple> where TTuple : Template

Type Parameters

TTuple

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

Inheritance
Object
TaskActionFactory<TTuple>
Inherited Members

Constructors

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

Initializes a new instance of the TaskActionFactory class.

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

Parameters

method Func<TTuple, CancellationToken, Task>

The System.Threading.Tasks.Task based function delegate to invoke.

tuple TTuple

The n-tuple argument of method.

Methods

Clone()

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

public override TemplateFactory<TTuple> Clone()

Returns

TemplateFactory<TTuple>

A new TaskActionFactory<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 System.Threading.CancellationToken.None.

Returns

Task

A task that represents the asynchronous operation.

Exceptions

System.InvalidOperationException

No delegate was specified on the factory.

System.OperationCanceledException

The ct was canceled.