title: Task-Cancellation after Task.WhenAny
body: <p>I have a method which spans multiple Tasks to do work in parallel - Their actual time to complete varies. When the first task finishes, the other work task(s) should be cancelled within the method like the code below:</p>
  
  <pre><code>static async Task DoWorkAsync(CancellationToken cancelToken){
      while(true) {
          using(CancellationTokenSource source = new CancellationTokenSource()) {
              Task workTask1 = Task.Delay(500, source.Token); // Some work
              Task workTask2 = Task.Delay(1500, source.Token); // Some other work
  
              await Task.WhenAny(workTask1, workTask2, Task.Delay(-1, cancelToken));
  
              if (cancelToken.IsCancellationRequested) break;
  
              source.Cancel();
  
              // Do something with result ...
          }
      }
  }
  </code></pre>
  
  <ul>
  <li>Is there a better way to deal with / cancel the unfinished other work-tasks?</li>
  <li>I am also wondering about the costs of creating new <code>CancellationTokenSource</code> objects within every loop iteration.</li>
  </ul>