Task.WaitAsync 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.
Overloads
WaitAsync(TimeSpan, 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(TimeSpan) |
Gets a Task that will complete when this Task completes or when the specified timeout expires. |
WaitAsync(CancellationToken) |
Gets a Task that will complete when this Task completes or when the specified CancellationToken has cancellation requested. |
WaitAsync(TimeSpan, CancellationToken)
Gets a Task that will complete when this Task completes, when the specified timeout expires, or when the specified CancellationToken has cancellation requested.
public:
System::Threading::Tasks::Task ^ WaitAsync(TimeSpan timeout, System::Threading::CancellationToken cancellationToken);
public System.Threading.Tasks.Task WaitAsync (TimeSpan timeout, System.Threading.CancellationToken cancellationToken);
member this.WaitAsync : TimeSpan * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function WaitAsync (timeout As TimeSpan, cancellationToken As CancellationToken) As Task
Parameters
- timeout
- TimeSpan
The timeout after which the Task should be faulted with a TimeoutException if it hasn't otherwise completed.
- 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.
Applies to
WaitAsync(TimeSpan)
public:
System::Threading::Tasks::Task ^ WaitAsync(TimeSpan timeout);
public System.Threading.Tasks.Task WaitAsync (TimeSpan timeout);
member this.WaitAsync : TimeSpan -> System.Threading.Tasks.Task
Public Function WaitAsync (timeout As TimeSpan) As Task
Parameters
- timeout
- TimeSpan
The timeout after which the Task should be faulted with a TimeoutException if it hasn't otherwise completed.
Returns
The Task representing the asynchronous wait. It may or may not be the same instance as the current instance.
Applies to
WaitAsync(CancellationToken)
Gets a Task that will complete when this Task completes or when the specified CancellationToken has cancellation requested.
public:
System::Threading::Tasks::Task ^ WaitAsync(System::Threading::CancellationToken cancellationToken);
public System.Threading.Tasks.Task WaitAsync (System.Threading.CancellationToken cancellationToken);
member this.WaitAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function WaitAsync (cancellationToken As CancellationToken) As Task
Parameters
- 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.