Task.WaitAsync Method (System.Threading.Tasks) (original) (raw)

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(CancellationToken)

Source:

Task.cs

Source:

Task.cs

Source:

Task.cs

Source:

Task.cs

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

Returns

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

Exceptions

The cancellation token was canceled. This exception is stored into the returned task.

Remarks

This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by Wait().

Applies to

WaitAsync(TimeSpan)

Source:

Task.cs

Source:

Task.cs

Source:

Task.cs

Source:

Task.cs

Gets a Task that will complete when this Task completes or when the specified timeout expires.

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

Returns

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

Remarks

This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by Wait(TimeSpan).

Applies to

WaitAsync(TimeSpan, CancellationToken)

Source:

Task.cs

Source:

Task.cs

Source:

Task.cs

Source:

Task.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:
 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

Returns

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

Exceptions

The cancellation token was canceled. This exception is stored into the returned task.

Remarks

This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by Wait(TimeSpan).

Applies to

WaitAsync(TimeSpan, TimeProvider)

Source:

Task.cs

Source:

Task.cs

Source:

Task.cs

Gets a Task that will complete when this Task completes or when the specified timeout expires.

public:
 System::Threading::Tasks::Task ^ WaitAsync(TimeSpan timeout, TimeProvider ^ timeProvider);
public System.Threading.Tasks.Task WaitAsync(TimeSpan timeout, TimeProvider timeProvider);
member this.WaitAsync : TimeSpan * TimeProvider -> System.Threading.Tasks.Task
Public Function WaitAsync (timeout As TimeSpan, timeProvider As TimeProvider) As Task

Parameters

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.

Applies to

WaitAsync(TimeSpan, TimeProvider, CancellationToken)

Source:

Task.cs

Source:

Task.cs

Source:

Task.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:
 System::Threading::Tasks::Task ^ WaitAsync(TimeSpan timeout, TimeProvider ^ timeProvider, System::Threading::CancellationToken cancellationToken);
public System.Threading.Tasks.Task WaitAsync(TimeSpan timeout, TimeProvider timeProvider, System.Threading.CancellationToken cancellationToken);
member this.WaitAsync : TimeSpan * TimeProvider * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function WaitAsync (timeout As TimeSpan, timeProvider As TimeProvider, cancellationToken As CancellationToken) As Task

Parameters

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.

The cancellation token was canceled. This exception is stored into the returned task.

Applies to