TimeProviderTaskExtensions.Delay Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Crée une tâche qui se termine après un intervalle de temps spécifié.
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
Paramètres
- timeProvider
- TimeProvider
Avec TimeProvider lequel interpréter delay.
- delay
- TimeSpan
TimeSpan À attendre avant d’effectuer la tâche retournée ou InfiniteTimeSpan d’attendre indéfiniment.
- cancellationToken
- CancellationToken
Jeton d’annulation à observer en attendant la fin de la tâche.
Retours
Tâche qui représente le délai d’attente.
Exceptions
L’argument timeProvider est null.
delay représente un intervalle de temps négatif autre que InfiniteTimeSpan.