Class TaskCompletionSourceExtensions (4.3.1)

public static class TaskCompletionSourceExtensions

Extension methods for TaskCompletionSource<TResult>.

Inheritance

object > TaskCompletionSourceExtensions

Namespace

GoogleGoogle.ApiGax

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

The task completion source. Must not be null.

cancellationTokenCancellationToken

The cancellation token to observe.

Returns
TypeDescription
Task

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