title: How can I cancel Task.WhenAll?
body: <p>Currenly using the following code to wait for a collection of tasks to complete.  However, I now have a situation where I want to be able to cancel/abort the WhenAll call, via a cancellation token preferably.  How would I go about that?</p>
  
  <pre><code>  Dim TaskCollection As New List(Of Tasks.Task)
    For x As Integer = 1 To Threads
      Dim NewTask As Tasks.Task = TaskHandler.Delegates(DelegateKey).Invoke(Me, Proxies, TotalParams).ContinueWith(Sub() ThreadFinished())
      TaskCollection.Add(NewTask)
    Next
  
    Await Tasks.Task.WhenAll(TaskCollection)
  </code></pre>
  
  <p>I'm assuming it's going to but something along the lines of the next bit of code, but I'm not sure what would go in 'XXX'.</p>
  
  <pre><code>Await Tasks.Task.WhenAny(Tasks.Task.WhenAll(TaskCollection), XXX)
  </code></pre>