title: How to use Task.WhenAll() for multiple Lists of different return types?
body: <p>I have two sets of Tasks, each with different result type:</p>
  
  <pre><code>IEnumerable&lt;Task&lt;T1&gt;&gt; set1 = GetTasksOfT1();
  IEnumerable&lt;Task&lt;T2&gt;&gt; set2 = GetTasksOfT2();
  </code></pre>
  
  <p>Now I would like to await both sets in one line, but I had to project set1 with cast:</p>
  
  <pre><code> await Task.WhenAll(set1.Select(p =&gt; p as Task).Concat(set2));
  </code></pre>
  
  <p>That's because I get this error if I don't use casting:</p>
  
  <pre><code>IEnumerable&lt;Task&lt;T1&gt;&gt;' does not contain a definition for 'Concat' 
  and the best extension method overload 'Queryable.Concat&lt;Task&lt;T2&gt;&gt;(IQueryable&lt;Task&lt;T2&gt;&gt;, IEnumerable&lt;Task&lt;T2&gt;&gt;)' 
  requires a receiver of type 'IQueryable&lt;Task&lt;T2&gt;&gt;'
  </code></pre>
  
  <p>Which is obvious.</p>
  
  <p>So is there a way to use a single WhenAll() without casting?</p>
  
  <p>Edit:
  The return types T1 and T2 <strong>are</strong> important - I consume them after the tasks are awaited:</p>
  
  <pre><code>//After await Task.WhenAll(...):
  var t1Results = await set1; // all set1 Tasks are completed by now 
  var t2Results = await set2; // same
  DoSomethingWithResults(t1Results, t2Results);
  </code></pre>