METHOD

Task.Delay (TimeSpan, TimeProvider, CancellationToken)

Returns a task representing a delay using the supplied time provider. Cancellation can end the wait. This does not guarantee a precise wake-up time or stop remote work.

Formal Syntax & Structure

csharp syntaxcsharp
await Task.Delay(delay,clock,token)

Working Example

Example Snippetcsharp
using System;using System.Collections.Generic;using System.Threading;using System.Threading.Tasks;using System.Threading.Channels;await Task.Delay(TimeSpan.Zero,TimeProvider.System,CancellationToken.None); Console.WriteLine("ready"); // ready
C# & .NET Reference