4.10.0 (latest) 4.8.0 4.4.0 4.3.1 4.2.0 4.0.0 3.2.0

    public static class Polling

Helper methods for polling scenarios.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> Polling

## Inherited Members

[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)) [object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) [object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Api.Gax](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.md.txt)

## Assembly

Google.Api.Gax.dll

## Methods

### PollRepeatedlyAsync\<TResponse\>(Func\<DateTime?, Task\<TResponse\>\>, Predicate\<TResponse\>, IClock, IScheduler, PollSettings, CancellationToken)

    public static Task<TResponse> PollRepeatedlyAsync<TResponse>(Func<DateTime?, Task<TResponse>> pollAction, Predicate<TResponse> completionPredicate, IClock clock, IScheduler scheduler, PollSettings pollSettings, CancellationToken cancellationToken)

Asynchronously repeatedly calls the specified polling action, delaying between calls,
until a given condition is met in the response.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `pollAction` | `FuncDateTimeTask` The poll action, typically performing an RPC. The value passed to the action is the overall deadline, so that the RPC settings can be adjusted accordingly. A null value indicates no deadline. |
| `completionPredicate` | `Predicate` The test for whether to return the response (`true`) or continue polling (`false`). Must not be null. |
| `clock` | `IClock` The clock to use for determining deadlines. Must not be null. |
| `scheduler` | `IScheduler` The scheduler to use for delaying between calls. Must not be null. |
| `pollSettings` | `PollSettings` The poll settings, controlling timeouts, call settings and delays. |
| `cancellationToken` | `CancellationToken` The cancellation token used to cancel delays, if any. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Task` | A task representing the asynchronous operation. The result of the task will be the completed response. |

| **Type Parameter** ||
|---|---|
| **Name** | **Description** |
| `TResponse` | The response type. |

### PollRepeatedly\<TResponse\>(Func\<DateTime?, TResponse\>, Predicate\<TResponse\>, IClock, IScheduler, PollSettings, CancellationToken)

    public static TResponse PollRepeatedly<TResponse>(Func<DateTime?, TResponse> pollAction, Predicate<TResponse> completionPredicate, IClock clock, IScheduler scheduler, PollSettings pollSettings, CancellationToken cancellationToken)

Repeatedly calls the specified polling action, delaying between calls,
until a given condition is met in the response.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `pollAction` | `FuncDateTime` The poll action, typically performing an RPC. The value passed to the action is the overall deadline, so that the RPC settings can be adjusted accordingly. A null value indicates no deadline. |
| `completionPredicate` | `Predicate` The test for whether to return the response (`true`) or continue polling (`false`). Must not be null. |
| `clock` | `IClock` The clock to use for determining deadlines. Must not be null. |
| `scheduler` | `IScheduler` The scheduler to use for delaying between calls. Must not be null. |
| `pollSettings` | `PollSettings` The poll settings, controlling timeouts, call settings and delays. |
| `cancellationToken` | `CancellationToken` The cancellation token used to cancel delays, if any. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `TResponse` | The completed response. |

| **Type Parameter** ||
|---|---|
| **Name** | **Description** |
| `TResponse` | The response type. |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `TimeoutException` | The timeout specified in the poll settings expired. |