Class TaskExtensions
Extension methods for tasks.
Inheritance
Inherited Members
Namespace: Google.Api.Gax
Assembly: Google.Api.Gax.dll
Syntax
public static class TaskExtensions
Methods
ResultWithUnwrappedExceptions<T>(Task<T>)
Synchronously waits for the given task to complete, and returns the result. Any System.AggregateException thrown is unwrapped to the first inner exception.
Declaration
public static T ResultWithUnwrappedExceptions<T>(this Task<T> task)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Threading.Tasks.Task<T> | task | The task to wait for. |
Returns
| Type | Description |
|---|---|
| T | The result of the completed task. |
Type Parameters
| Name | Description |
|---|---|
| T | The result type of the task |
WaitWithUnwrappedExceptions(Task)
Synchronously waits for the given task to complete. Any System.AggregateException thrown is unwrapped to the first inner exception.
Declaration
public static void WaitWithUnwrappedExceptions(this Task task)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Threading.Tasks.Task | task | The task to wait for. |
WaitWithUnwrappedExceptions(Task, Int32)
Synchronously waits for the given task to complete. Any System.AggregateException thrown is unwrapped to the first inner exception.
Declaration
public static bool WaitWithUnwrappedExceptions(this Task task, int millisecondsTimeout)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Threading.Tasks.Task | task | The task to wait for. |
| System.Int32 | millisecondsTimeout | The number of milliseconds to wait, or -1 to wait indefinitely. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
WaitWithUnwrappedExceptions(Task, Int32, CancellationToken)
Synchronously waits for the given task to complete. Any System.AggregateException thrown is unwrapped to the first inner exception.
Declaration
public static bool WaitWithUnwrappedExceptions(this Task task, int millisecondsTimeout, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Threading.Tasks.Task | task | The task to wait for. |
| System.Int32 | millisecondsTimeout | The number of milliseconds to wait, or -1 to wait indefinitely. |
| System.Threading.CancellationToken | cancellationToken | A cancellation token to observe while waiting for the task to complete |
Returns
| Type | Description |
|---|---|
| System.Boolean |
WaitWithUnwrappedExceptions(Task, CancellationToken)
Synchronously waits for the given task to complete. Any System.AggregateException thrown is unwrapped to the first inner exception.
Declaration
public static void WaitWithUnwrappedExceptions(this Task task, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Threading.Tasks.Task | task | The task to wait for. |
| System.Threading.CancellationToken | cancellationToken | A cancellation token to observe while waiting for the task to complete |
WaitWithUnwrappedExceptions(Task, TimeSpan)
Synchronously waits for the given task to complete. Any System.AggregateException thrown is unwrapped to the first inner exception.
Declaration
public static bool WaitWithUnwrappedExceptions(this Task task, TimeSpan timeout)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Threading.Tasks.Task | task | The task to wait for. |
| System.TimeSpan | timeout | A TimeSpan that represents the number of milliseconds to wait, or -1 milliseconds to wait indefinitely. |
Returns
| Type | Description |
|---|---|
| System.Boolean |