Class TaskExtensions

public static class TaskExtensions

Extension methods for tasks.

Inheritance

Object > TaskExtensions

Namespace

Google.Api.Gax

Assembly

Google.Api.Gax.dll

Methods

ResultWithUnwrappedExceptions<T>(Task<T>)

public static T ResultWithUnwrappedExceptions<T>(this Task<T> task)

Synchronously waits for the given task to complete, and returns the result. Any AggregateException thrown is unwrapped to the first inner exception.

Parameter
TypeNameDescription
Task<T>task

The task to wait for.

Returns
TypeDescription
T

The result of the completed task.

Type Parameter
NameDescription
T

The result type of the task

WaitWithUnwrappedExceptions(Task)

public static void WaitWithUnwrappedExceptions(this Task task)

Synchronously waits for the given task to complete. Any AggregateException thrown is unwrapped to the first inner exception.

Parameter
TypeNameDescription
Tasktask

The task to wait for.

WaitWithUnwrappedExceptions(Task, Int32)

public static bool WaitWithUnwrappedExceptions(this Task task, int millisecondsTimeout)

Synchronously waits for the given task to complete. Any AggregateException thrown is unwrapped to the first inner exception.

Parameters
TypeNameDescription
Tasktask

The task to wait for.

Int32millisecondsTimeout

The number of milliseconds to wait, or -1 to wait indefinitely.

Returns
TypeDescription
Boolean

WaitWithUnwrappedExceptions(Task, Int32, CancellationToken)

public static bool WaitWithUnwrappedExceptions(this Task task, int millisecondsTimeout, CancellationToken cancellationToken)

Synchronously waits for the given task to complete. Any AggregateException thrown is unwrapped to the first inner exception.

Parameters
TypeNameDescription
Tasktask

The task to wait for.

Int32millisecondsTimeout

The number of milliseconds to wait, or -1 to wait indefinitely.

CancellationTokencancellationToken

A cancellation token to observe while waiting for the task to complete

Returns
TypeDescription
Boolean

WaitWithUnwrappedExceptions(Task, CancellationToken)

public static void WaitWithUnwrappedExceptions(this Task task, CancellationToken cancellationToken)

Synchronously waits for the given task to complete. Any AggregateException thrown is unwrapped to the first inner exception.

Parameters
TypeNameDescription
Tasktask

The task to wait for.

CancellationTokencancellationToken

A cancellation token to observe while waiting for the task to complete

WaitWithUnwrappedExceptions(Task, TimeSpan)

public static bool WaitWithUnwrappedExceptions(this Task task, TimeSpan timeout)

Synchronously waits for the given task to complete. Any AggregateException thrown is unwrapped to the first inner exception.

Parameters
TypeNameDescription
Tasktask

The task to wait for.

TimeSpantimeout

A TimeSpan that represents the number of milliseconds to wait, or -1 milliseconds to wait indefinitely.

Returns
TypeDescription
Boolean