แก้ไข

แชร์ผ่าน


TimeProviderTaskExtensions.WaitAsync Method

Definition

Overloads

WaitAsync(Task, TimeSpan, TimeProvider, CancellationToken)

Gets a Task that will complete when this Task completes, when the specified timeout expires, or when the specified CancellationToken has cancellation requested.

WaitAsync<TResult>(Task<TResult>, TimeSpan, TimeProvider, CancellationToken)

Gets a Task that will complete when this Task completes, when the specified timeout expires, or when the specified CancellationToken has cancellation requested.

WaitAsync(Task, TimeSpan, TimeProvider, CancellationToken)

Source:
TimeProviderTaskExtensions.cs
Source:
TimeProviderTaskExtensions.cs

Gets a Task that will complete when this Task completes, when the specified timeout expires, or when the specified CancellationToken has cancellation requested.

public static System.Threading.Tasks.Task WaitAsync (this System.Threading.Tasks.Task task, TimeSpan timeout, TimeProvider timeProvider, System.Threading.CancellationToken cancellationToken = default);
static member WaitAsync : System.Threading.Tasks.Task * TimeSpan * TimeProvider * System.Threading.CancellationToken -> System.Threading.Tasks.Task
<Extension()>
Public Function WaitAsync (task As Task, timeout As TimeSpan, timeProvider As TimeProvider, Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

task
Task

The task for which to wait on until completion.

timeout
TimeSpan

The timeout after which the Task should be faulted with a TimeoutException if it hasn't otherwise completed.

timeProvider
TimeProvider

The TimeProvider with which to interpret timeout.

cancellationToken
CancellationToken

The CancellationToken to monitor for a cancellation request.

Returns

The Task representing the asynchronous wait. It may or may not be the same instance as the current instance.

Exceptions

The timeProvider argument is null.

timeout represents a negative time interval other than InfiniteTimeSpan.

Applies to

WaitAsync<TResult>(Task<TResult>, TimeSpan, TimeProvider, CancellationToken)

Source:
TimeProviderTaskExtensions.cs
Source:
TimeProviderTaskExtensions.cs

Gets a Task that will complete when this Task completes, when the specified timeout expires, or when the specified CancellationToken has cancellation requested.

public static System.Threading.Tasks.Task<TResult> WaitAsync<TResult> (this System.Threading.Tasks.Task<TResult> task, TimeSpan timeout, TimeProvider timeProvider, System.Threading.CancellationToken cancellationToken = default);
static member WaitAsync : System.Threading.Tasks.Task<'Result> * TimeSpan * TimeProvider * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Result>
<Extension()>
Public Function WaitAsync(Of TResult) (task As Task(Of TResult), timeout As TimeSpan, timeProvider As TimeProvider, Optional cancellationToken As CancellationToken = Nothing) As Task(Of TResult)

Type Parameters

TResult

Parameters

task
Task<TResult>

The task for which to wait on until completion.

timeout
TimeSpan

The timeout after which the Task should be faulted with a TimeoutException if it hasn't otherwise completed.

timeProvider
TimeProvider

The TimeProvider with which to interpret timeout.

cancellationToken
CancellationToken

The CancellationToken to monitor for a cancellation request.

Returns

The Task representing the asynchronous wait. It may or may not be the same instance as the current instance.

Exceptions

The timeProvider argument is null.

timeout represents a negative time interval other than InfiniteTimeSpan.

Applies to