title: What actually happens when using async/await inside a LINQ statement?
body: <p>The following snippet compiles, but I'd expect it to await the task result instead of giving me a <code>List&lt;Task&lt;T&gt;&gt;</code>.</p>
  
  <pre><code>var foo = bars.Select(async bar =&gt; await Baz(bar)).ToList()
  </code></pre>
  
  <p>As pointed out <a href="https://stackoverflow.com/a/21868161/247702">here</a>, you need to use <code>Task.WhenAll</code>:</p>
  
  <pre><code>var tasks = foos.Select(async foo =&gt; await DoSomethingAsync(foo)).ToList();
  await Task.WhenAll(tasks);
  </code></pre>
  
  <p>But <a href="https://stackoverflow.com/questions/21868087/how-to-await-a-list-of-tasks-asynchronously-using-linq#comment33110750_21868161">a comment</a> points out that the <code>async</code> and <code>await</code> inside the <code>Select()</code> is not needed:</p>
  
  <pre><code>var tasks = foos.Select(foo =&gt; DoSomethingAsync(foo)).ToList();
  </code></pre>
  
  <p>A similar question <a href="https://codereview.stackexchange.com/questions/32160/filtering-a-collection-by-an-async-result">here</a> where someone tries to use an async method inside a <code>Where()</code>.</p>
  
  <p>So <code>async</code> and <code>await</code> inside a LINQ statement is legal syntax, but does it do nothing at all or does it have a certain use?</p>