Class ResultTask
Provides a static factory method for ResultTask<T> as an alternative to calling the constructor to exploit type inference.
Namespace: NanoByte.Common.Tasks
Assembly: NanoByte.Common.dll
Syntax
public static class ResultTask : Object
Methods
Create<T>(String, Func<T>, Action)
Creates a new task that executes a callback and the provides a result. Only completion is reported, no intermediate progress.
Declaration
public static ResultTask<T> Create<T>(string name, Func<T> work, Action cancellationCallback = null)
Parameters
Type | Name | Description |
---|---|---|
String | name | A name describing the task in human-readable form. |
Func<T> | work | The code to be executed by the task that provides a result. May throw WebException, IOException or OperationCanceledException. |
Action | cancellationCallback | An optional callback to be called when cancellation is requested via a CancellationToken. |
Returns
Type | Description |
---|---|
ResultTask<T> |
Type Parameters
Name | Description |
---|---|
T |