Show / Hide Table of Contents

Class TaskCompletionSourceExtensions

Extension methods for System.Threading.Tasks.TaskCompletionSource<TResult>.

Inheritance
System.Object
TaskCompletionSourceExtensions
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Google.Api.Gax
Assembly: Google.Api.Gax.dll
Syntax
public static class TaskCompletionSourceExtensions

Methods

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

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

Declaration
public static Task<TResult> WithCancellationToken<TResult>(this TaskCompletionSource<TResult> source, CancellationToken cancellationToken)
Parameters
Type Name Description
System.Threading.Tasks.TaskCompletionSource<TResult> source

The task completion source. Must not be null.

System.Threading.CancellationToken cancellationToken

The cancellation token to observe.

Returns
Type Description
System.Threading.Tasks.Task<TResult>

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

Type Parameters
Name Description
TResult

The result type of the task completion source

Back to top