共用方式為


VsTaskLibraryHelper.CancelWhenCancellationRequested Method

Definition

Ensures that task will be canceled when cancellation is requested for cancellationToken.

public:
[System::Runtime::CompilerServices::Extension]
 static void CancelWhenCancellationRequested(Microsoft::VisualStudio::Shell::Interop::IVsTask ^ task, Microsoft::VisualStudio::Threading::JoinableTaskFactory ^ jtf, System::Threading::CancellationToken cancellationToken);
public static void CancelWhenCancellationRequested (this Microsoft.VisualStudio.Shell.Interop.IVsTask task, Microsoft.VisualStudio.Threading.JoinableTaskFactory jtf, System.Threading.CancellationToken cancellationToken);
static member CancelWhenCancellationRequested : Microsoft.VisualStudio.Shell.Interop.IVsTask * Microsoft.VisualStudio.Threading.JoinableTaskFactory * System.Threading.CancellationToken -> unit
<Extension()>
Public Sub CancelWhenCancellationRequested (task As IVsTask, jtf As JoinableTaskFactory, cancellationToken As CancellationToken)

Parameters

task
IVsTask

The task to cancel.

cancellationToken
CancellationToken

The token whose cancellation triggers the cancellation of task.

Applies to