0
{
  Task myTask = Task.Run(() => method(), cancelTokenSource.Token);
  cancelTokenSource.cancel();
}

void method()
{
    //Without specify any code like 
    cancelTokenSource.Token.ThrowIfCancellationRequested();
}

is there any alternate way to cancel the running task?

Alexei Levenkov
  • 96,782
  • 12
  • 124
  • 169
Moorthy
  • 1
  • 2

0 Answers0