Class TaskCompletionSourceExtensions (3.2.0)

public static class TaskCompletionSourceExtensions

Extension methods for TaskCompletionSource<TResult>.

Inheritance

Object > TaskCompletionSourceExtensions

Namespace

Google.Api.Gax

Assembly

Google.Api.Gax.dll

Methods

WithCancellationToken<TResult>(TaskCompletionSource<TResult>, CancellationToken)

public static Task<TResult> WithCancellationToken<TResult>(this TaskCompletionSource<TResult> source, CancellationToken cancellationToken)

Returns a task from a task completion source, but observing a given cancellation token.

Parameters
NameDescription
sourceTaskCompletionSource<TResult>

The task completion source. Must not be null.

cancellationTokenCancellationToken

The cancellation token to observe.

Returns
TypeDescription
Task<TResult>

A task that will complete when source completes, but will observe cancellationToken for cancellation.

Type Parameter
NameDescription
TResult

The result type of the task completion source