# Class SchedulerExtensions (4.10.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [4.10.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.SchedulerExtensions)
- [4.8.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/4.8.0/Google.Api.Gax.SchedulerExtensions)
- [4.4.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/4.4.0/Google.Api.Gax.SchedulerExtensions)
- [4.3.1](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/4.3.1/Google.Api.Gax.SchedulerExtensions)
- [4.2.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/4.2.0/Google.Api.Gax.SchedulerExtensions)
- [4.0.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/4.0.0/Google.Api.Gax.SchedulerExtensions)
- [3.2.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/3.2.0/Google.Api.Gax.SchedulerExtensions)

    public static class SchedulerExtensions

Extension methods for [IScheduler](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.IScheduler).

## Inheritance

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

## 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)

## Assembly

Google.Api.Gax.dll

## Methods

### Sleep(IScheduler, TimeSpan, CancellationToken)

    public static void Sleep(this IScheduler scheduler, TimeSpan delay, CancellationToken cancellationToken)

Simulates a synchronous delay by calling [Delay(TimeSpan, CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.IScheduler#Google_Api_Gax_IScheduler_Delay_System_TimeSpan_System_Threading_CancellationToken_) on
`scheduler`, and unwrapping any exceptions generated (typically cancellation).

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `scheduler` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.IScheduler` The scheduler to use for the sleep operation. |
| `delay` | `https://learn.microsoft.com/dotnet/api/system.timespan` Time to sleep for. Must not be negative. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` The cancellation token that will be watched during the sleep operation. |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.operationcanceledexception` | The cancellation token was cancelled during the sleep. |