July 2015
Intermediate to advanced
1300 pages
87h 27m
English
In some situations you want to cancel task execution. To programmatically cancel a task, you need to enable tasks for cancellation, which requires some lines of code. You need an instance of the System.Threading.CancellationTokenSource class; this instance tells a System.Threading.CancellationToken that it should be canceled. The CancellationToken class provides notifications for cancellation. The following lines declare both objects:
Dim tokenSource As New CancellationTokenSource()Dim token As CancellationToken = tokenSource.Token
Setting Time for Cancellation
The .NET Framework 4.6 enables you to create an instance of the Cancellation-TokenSource class and specify on such an instance how much time ...