Returns a task which will complete after the given delay. Whether the returned
awaitable is configured to capture the current context or not is implementation-specific.
(A test implementation may capture the current context to enable reliable testing.)
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003eThis webpage details the \u003ccode\u003eIScheduler\u003c/code\u003e interface within the \u003ccode\u003eGoogle.Api.Gax\u003c/code\u003e namespace, designed for abstracting scheduler operations, particularly for testing.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eIScheduler\u003c/code\u003e interface, found in the \u003ccode\u003eGoogle.Api.Gax.dll\u003c/code\u003e assembly, provides a means of managing delays, differing from \u003ccode\u003eTaskScheduler\u003c/code\u003e which is focused on thread assignment.\u003c/p\u003e\n"],["\u003cp\u003eThe primary method provided by \u003ccode\u003eIScheduler\u003c/code\u003e is \u003ccode\u003eDelay\u003c/code\u003e, which allows the specification of a delay and a cancellation token, returning a task that completes after the designated delay period.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version of the scheduler described is 4.10.0, with previous versions such as 4.8.0, 4.4.0, 4.3.1, 4.2.0, 4.0.0, and 3.2.0 also being listed.\u003c/p\u003e\n"],["\u003cp\u003eThe page also references the extension method \u003ccode\u003eSchedulerExtensions.Sleep\u003c/code\u003e, which can be found in the \u003ccode\u003eGoogle.Api.Gax.SchedulerExtensions\u003c/code\u003e class and accepts an \u003ccode\u003eIScheduler\u003c/code\u003e, a \u003ccode\u003eTimeSpan\u003c/code\u003e, and a \u003ccode\u003eCancellationToken\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Interface IScheduler (4.10.0)\n\nVersion latestkeyboard_arrow_down\n\n- [4.10.0 (latest)](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.IScheduler)\n- [4.8.0](/dotnet/docs/reference/Google.Api.Gax/4.8.0/Google.Api.Gax.IScheduler)\n- [4.4.0](/dotnet/docs/reference/Google.Api.Gax/4.4.0/Google.Api.Gax.IScheduler)\n- [4.3.1](/dotnet/docs/reference/Google.Api.Gax/4.3.1/Google.Api.Gax.IScheduler)\n- [4.2.0](/dotnet/docs/reference/Google.Api.Gax/4.2.0/Google.Api.Gax.IScheduler)\n- [4.0.0](/dotnet/docs/reference/Google.Api.Gax/4.0.0/Google.Api.Gax.IScheduler)\n- [3.2.0](/dotnet/docs/reference/Google.Api.Gax/3.2.0/Google.Api.Gax.IScheduler) \n\n public interface IScheduler\n\nAbstraction of scheduler-like operations, used for testability.\n\nNamespace\n---------\n\n[Google.Api.Gax](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax)\n\nAssembly\n--------\n\nGoogle.Api.Gax.dll\n\nRemarks\n-------\n\nNote that this is different to [TaskScheduler](https://learn.microsoft.com/dotnet/api/system.threading.tasks.taskscheduler), which is really involved\nwith assigning tasks to threads rather than any sort of delay.\n\nMethods\n-------\n\n### Delay(TimeSpan, CancellationToken)\n\n Task Delay(TimeSpan delay, CancellationToken cancellationToken)\n\nReturns a task which will complete after the given delay. Whether the returned\nawaitable is configured to capture the current context or not is implementation-specific.\n(A test implementation may capture the current context to enable reliable testing.)\n\nExtension Method\n----------------\n\n[SchedulerExtensions.Sleep(IScheduler, TimeSpan, CancellationToken)](/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.SchedulerExtensions#Google_Api_Gax_SchedulerExtensions_Sleep_Google_Api_Gax_IScheduler_System_TimeSpan_System_Threading_CancellationToken_)"]]