Table of Contents

Class TaskExtensions

Namespace
NanoByte.Common.Threading
Assembly
NanoByte.Common.dll
public static class TaskExtensions
Inheritance
object
TaskExtensions

Methods

WaitAsync(Task, CancellationToken)

Gets a System.Threading.Tasks.Task that will complete when task completes or when the specified cancellationToken has cancellation requested.

public static Task WaitAsync(this Task task, CancellationToken cancellationToken)

Parameters

task Task
cancellationToken CancellationToken

Returns

Task

Exceptions

OperationCanceledException

Cancellation has been requested.

WaitAsync<T>(Task<T>, CancellationToken)

Gets a System.Threading.Tasks.Task that will complete when task completes or when the specified cancellationToken has cancellation requested.

public static Task<T> WaitAsync<T>(this Task<T> task, CancellationToken cancellationToken)

Parameters

task Task<T>
cancellationToken CancellationToken

Returns

Task<T>

Type Parameters

T

Exceptions

OperationCanceledException

Cancellation has been requested.