ThreadingTools::WithCancellation Method (Task^, CancellationToken)
Visual Studio 2015
Wraps a task with one that will complete as cancelled based on a cancellation token, allowing someone to await a task but be able to break out early by cancelling the token.
Assembly: Microsoft.VisualStudio.Threading (in Microsoft.VisualStudio.Threading.dll)
public: [ExtensionAttribute] static Task^ WithCancellation( Task^ task, CancellationToken cancellationToken )
Parameters
- task
-
Type:
System.Threading.Tasks::Task^
The task to wrap.
- cancellationToken
-
Type:
System.Threading::CancellationToken
The token that can be canceled to break out of the await.
Show: