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
  • 98,904
  • 14
  • 127
  • 179
Moorthy
  • 1
  • 2

0 Answers0