Udostępnij za pośrednictwem


TplExtensions.AppendAction Method

Definition

Schedules some action for execution at the conclusion of a task, regardless of the task's outcome.

public static System.Threading.Tasks.Task AppendAction (this System.Threading.Tasks.Task task, Action action, System.Threading.Tasks.TaskContinuationOptions options = System.Threading.Tasks.TaskContinuationOptions.None, System.Threading.CancellationToken cancellation = default);
static member AppendAction : System.Threading.Tasks.Task * Action * System.Threading.Tasks.TaskContinuationOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task
<Extension()>
Public Function AppendAction (task As Task, action As Action, Optional options As TaskContinuationOptions = System.Threading.Tasks.TaskContinuationOptions.None, Optional cancellation As CancellationToken = Nothing) As Task

Parameters

task
Task

The task that should complete before the posted action is invoked.

action
Action

The action to execute after task has completed.

options
TaskContinuationOptions

The task continuation options to apply.

cancellation
CancellationToken

The cancellation token that signals the continuation should not execute (if it has not already begun).

Returns

The task that will execute the action.

Applies to