Share via


ResourceNotificationService.WaitForResourceAsync Method

Definition

Overloads

WaitForResourceAsync(String, IEnumerable<String>, CancellationToken)

Waits for a resource to reach one of the specified states. See KnownResourceStates for common states.

WaitForResourceAsync(String, String, CancellationToken)

Waits for a resource to reach the specified state. See KnownResourceStates for common states.

WaitForResourceAsync(String, IEnumerable<String>, CancellationToken)

Source:
ResourceNotificationService.cs

Waits for a resource to reach one of the specified states. See KnownResourceStates for common states.

public System.Threading.Tasks.Task<string> WaitForResourceAsync (string resourceName, System.Collections.Generic.IEnumerable<string> targetStates, System.Threading.CancellationToken cancellationToken = default);
member this.WaitForResourceAsync : string * seq<string> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<string>
Public Function WaitForResourceAsync (resourceName As String, targetStates As IEnumerable(Of String), Optional cancellationToken As CancellationToken = Nothing) As Task(Of String)

Parameters

resourceName
String

The name of the resource.

targetStates
IEnumerable<String>

The set of states to wait for the resource to transition to one of. See KnownResourceStates for common states.

cancellationToken
CancellationToken

A cancellation token that cancels the wait operation when signaled.

Returns

A Task<TResult> representing the wait operation and which of the target states the resource reached.

Remarks

This method returns a task that will complete when the resource reaches one of the specified target states. If the resource is already in the target state, the method will return immediately.
If the resource doesn't reach one of the target states before cancellationToken is signaled, this method will throw OperationCanceledException.

Applies to

WaitForResourceAsync(String, String, CancellationToken)

Source:
ResourceNotificationService.cs

Waits for a resource to reach the specified state. See KnownResourceStates for common states.

public System.Threading.Tasks.Task WaitForResourceAsync (string resourceName, string? targetState = default, System.Threading.CancellationToken cancellationToken = default);
member this.WaitForResourceAsync : string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function WaitForResourceAsync (resourceName As String, Optional targetState As String = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

resourceName
String

The name of the resource.

targetState
String
cancellationToken
CancellationToken

A CancellationToken

Returns

A Task representing the wait operation.

Remarks

This method returns a task that will complete when the resource reaches the specified target state. If the resource is already in the target state, the method will return immediately.
If the resource doesn't reach one of the target states before cancellationToken is signaled, this method will throw OperationCanceledException.

Applies to