title: How to await a list of tasks asynchronously using LINQ?
body: <p>I have a list of tasks that I created like this:</p>
  
  <pre><code>public async Task&lt;IList&lt;Foo&gt;&gt; GetFoosAndDoSomethingAsync()
  {
      var foos = await GetFoosAsync();
  
      var tasks = foos.Select(async foo =&gt; await DoSomethingAsync(foo)).ToList();
  
      ...
  }
  </code></pre>
  
  <p>By using <code>.ToList()</code>, the tasks should all start. Now I want to await their completion and return the results.</p>
  
  <p>This works in the above <code>...</code> block:</p>
  
  <pre><code>var list = new List&lt;Foo&gt;();
  foreach (var task in tasks)
      list.Add(await task);
  return list;
  </code></pre>
  
  <p>It does what I want, but this seems rather clumsy. I'd much rather write something simpler like this:</p>
  
  <pre><code>return tasks.Select(async task =&gt; await task).ToList();
  </code></pre>
  
  <p>... but this doesn't compile. What am I missing? Or is it just not possible to express things this way?</p>