Class TaskActionFactory<TTuple>
Provides an easy way of invoking an Action delegate regardless of the amount of parameters provided.
Inherited Members
Namespace: Cuemon
Assembly: Cuemon.Core.dll
Syntax
public sealed class TaskActionFactory<TTuple> : TemplateFactory<TTuple> where TTuple : Template
Type Parameters
Name | Description |
---|---|
TTuple | The type of the n-tuple representation of a Template. |
Constructors
| Improve this Doc View SourceTaskActionFactory(Func<TTuple, CancellationToken, Task>, TTuple)
Initializes a new instance of the TaskActionFactory class.
Declaration
public TaskActionFactory(Func<TTuple, CancellationToken, Task> method, TTuple tuple)
Parameters
Type | Name | Description |
---|---|---|
Func<TTuple, CancellationToken, Task> | method | The Task based function delegate to invoke. |
TTuple | tuple | The n-tuple argument of |
Methods
| Improve this Doc View SourceClone()
Creates a shallow copy of the current TaskActionFactory<TTuple> object.
Declaration
public override TemplateFactory<TTuple> Clone()
Returns
Type | Description |
---|---|
TemplateFactory<TTuple> | A new TaskActionFactory<TTuple> that is a copy of this instance. |
Overrides
Cuemon.TemplateFactory<TTuple>.Clone()
Remarks
When thread safety is required this is the method to invoke.
ExecuteMethodAsync(CancellationToken)
Executes the delegate associated with this instance.
Declaration
public Task ExecuteMethodAsync(CancellationToken ct)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | ct | The token to monitor for cancellation requests. The default value is None. |
Returns
Type | Description |
---|---|
Task | A task that represents the asynchronous operation. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | No delegate was specified on the factory. |
OperationCanceledException | The |