title: How to check that all tasks have been properly completed?
body: <p>I have the following lines in my code:</p>
  
  <pre><code>    var taskA = Task.Factory.StartNew(WorkA);
      var taskB = Task.Factory.StartNew(WorkB);
      var allTasks = new[] { taskA, taskB };
  
      Task.Factory.ContinueWhenAll(allTasks, tasks =&gt; FinalWork(), TaskContinuationOptions.OnlyOnRanToCompletion);
  </code></pre>
  
  <p>But when I run this, I get the following error:</p>
  
  <blockquote>
    <p>It is invalid to exclude specific continuation kinds for continuations off of multiple tasks.</p>
  </blockquote>
  
  <p>Which is caused by the option <strong>TaskContinuationOptions.OnlyOnRanToCompletion</strong>.</p>
  
  <p>My question is how to check that all tasks have done their work properly (all tasks statuses are <strong>RanToCompletion</strong>) and then do <strong>FinalWork()</strong>?
  In the meantime, the application performs other tasks.</p>