Class ResultTask
Provides a static factory method for ResultTask<T> as an alternative to calling the constructor to exploit type inference.
public static class ResultTask
- Inheritance
-
objectResultTask
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.
public static ResultTask<T> Create<T>(string name, Func<T> work, Action? cancellationCallback = null)
Parameters
name
stringA name describing the task in human-readable form.
work
Func<T>The code to be executed by the task that provides a result. May throw System.Net.WebException, System.IO.IOException or System.OperationCanceledException.
cancellationCallback
ActionAn optional callback to be called when cancellation is requested via a System.Threading.CancellationToken.
Returns
- ResultTask<T>
Type Parameters
T