TplExtensions::FollowCancelableTaskToCompletion<T> Method (Func<Task<T>^>^, CancellationToken, TaskCompletionSource<T>^)

 

Gets a task that will eventually produce the result of another task, when that task finishes. If that task is instead canceled, its successor will be followed for its result, iteratively.

Namespace:   Microsoft.VisualStudio.Threading
Assembly:  Microsoft.VisualStudio.Threading (in Microsoft.VisualStudio.Threading.dll)

public:
generic<typename T>
static Task<T>^ FollowCancelableTaskToCompletion(
	Func<Task<T>^>^ taskToFollow,
	CancellationToken ultimateCancellation,
	TaskCompletionSource<T>^ taskThatFollows = null
)

Parameters

taskToFollow
Type: System::Func<Task<T>^>^

The task whose result should be returned by the following task.

ultimateCancellation
Type: System.Threading::CancellationToken

A token whose cancellation signals that the following task should be cancelled.

taskThatFollows
Type: System.Threading.Tasks::TaskCompletionSource<T>^

The TaskCompletionSource whose task is to follow. Leave as null for a new task to be created.

Return Value

Type: System.Threading.Tasks::Task<T>^

A following Task<TResult>.

Type Parameters

T

The type of value returned by the task.

Return to top
Show: