Table of Contents

Class ResultTask

Namespace
NanoByte.Common.Tasks
Assembly
NanoByte.Common.dll

Provides a static factory method for ResultTask<T> as an alternative to calling the constructor to exploit type inference.

public static class ResultTask
Inheritance
ResultTask

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 string

A 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 WebException, IOException or OperationCanceledException.

cancellationCallback Action

An optional callback to be called when cancellation is requested via a CancellationToken.

Returns

ResultTask<T>

Type Parameters

T