title: Using async/await for multiple tasks
body: <p>I'm using an API client that is completely asynchrounous, that is, each operation either returns <code>Task</code> or <code>Task&lt;T&gt;</code>, e.g:</p>
  
  <pre><code>static async Task DoSomething(int siteId, int postId, IBlogClient client)
  {
      await client.DeletePost(siteId, postId); // call API client
      Console.WriteLine("Deleted post {0}.", siteId);
  }
  </code></pre>
  
  <p>Using the C# 5 async/await operators, what is the correct/most efficient way to start multiple tasks and wait for them all to complete:</p>
  
  <pre><code>int[] ids = new[] { 1, 2, 3, 4, 5 };
  Parallel.ForEach(ids, i =&gt; DoSomething(1, i, blogClient).Wait());
  </code></pre>
  
  <p>or:</p>
  
  <pre><code>int[] ids = new[] { 1, 2, 3, 4, 5 };
  Task.WaitAll(ids.Select(i =&gt; DoSomething(1, i, blogClient)).ToArray());
  </code></pre>
  
  <p>Since the API client is using HttpClient internally, I would expect this to issue 5 HTTP requests immediately, writing to the console as each one completes.</p>