TimeProviderTaskExtensions.Delay Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates a task that completes after a specified time interval.
public static System.Threading.Tasks.Task Delay(this TimeProvider timeProvider, TimeSpan delay, System.Threading.CancellationToken cancellationToken = default);
static member Delay : TimeProvider * TimeSpan * System.Threading.CancellationToken -> System.Threading.Tasks.Task
<Extension()>
Public Function Delay (timeProvider As TimeProvider, delay As TimeSpan, Optional cancellationToken As CancellationToken = Nothing) As Task
- timeProvider
- TimeProvider
The TimeProvider with which to interpret delay
.
- delay
- TimeSpan
The TimeSpan to wait before completing the returned task, or InfiniteTimeSpan to wait indefinitely.
- cancellationToken
- CancellationToken
A cancellation token to observe while waiting for the task to complete.
A task that represents the time delay.
The timeProvider
argument is null.
delay
represents a negative time interval other than InfiniteTimeSpan.
Applies to
Продукт | Версії |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided) |
.NET Standard | 2.0 (package-provided) |
Відгук про .NET
.NET – це проект із відкритим кодом. Виберіть посилання, щоб надати відгук: