Share via


RetryPolicy.ExecuteAsync<TResult> Method (Func<Task<TResult>>, CancellationToken)

 

Repeatedly executes the specified asynchronous task while it satisfies the current retry policy.

Namespace:   Microsoft.WindowsAzure.Common.TransientFaultHandling
Assembly:  Microsoft.WindowsAzure.Common (in Microsoft.WindowsAzure.Common.dll)

Syntax

public Task<TResult> ExecuteAsync<TResult>(
    Func<Task<TResult>> taskFunc,
    CancellationToken cancellationToken
)
public:
generic<typename TResult>
Task<TResult>^ ExecuteAsync(
    Func<Task<TResult>^>^ taskFunc,
    CancellationToken cancellationToken
)
member ExecuteAsync<'TResult> : 
        taskFunc:Func<Task<'TResult>> *
        cancellationToken:CancellationToken -> Task<'TResult>
Public Function ExecuteAsync(Of TResult) (
    taskFunc As Func(Of Task(Of TResult)),
    cancellationToken As CancellationToken
) As Task(Of TResult)

Parameters

  • taskFunc
    Type: System.Func<Task<TResult>>

    A function that returns a started task (also known as "hot" task).

  • cancellationToken
    Type: System.Threading.CancellationToken

    The token used to cancel the retry operation. This token does not cancel the execution of the asynchronous task.

Return Value

Type: System.Threading.Tasks.Task<TResult>

Returns a task that will run to completion if the original task completes successfully (either the first time or after retrying transient failures). If the task fails with a non-transient error or the retry limit is reached, the returned task will transition to a faulted state and the exception must be observed.

See Also

ExecuteAsync Overload
RetryPolicy Class
Microsoft.WindowsAzure.Common.TransientFaultHandling Namespace

Return to top