title: Proper use of Task.WhenAll
body: <p>I am trying to wrap my head around <code>async</code>/<code>await</code> and wanted to know if this is the proper use of the <code>Task.WhenAll</code> method:</p>
  
  <pre><code>public class AsyncLib
  {
      public async Task&lt;IEnumerable&lt;string&gt;&gt; DoIt()
      {
          var urls = new string[] { "http://www.msn.com", "http://www.google.com" };
  
          var tasks = urls.Select(x =&gt; this.GetUrlContents(x));
  
          var results = await Task.WhenAll(tasks);
  
          return results.Select(x =&gt; x);
      }
  
      public async Task&lt;string&gt; GetUrlContents(string url)
      {
          using (var client = new WebClient())
          {
              return await client.DownloadStringTaskAsync(url);
          }
      }
  }
  </code></pre>
  
  <p><strong>Main</strong></p>
  
  <p>This is the calling console application.</p>
  
  <pre><code>class Program
  {
      static void Main(string[] args)
      {
          var lib = new AsyncLib();
          foreach(var item in lib.DoIt().Result)
          {
              Console.WriteLine(item.Length);
          }
          Console.Read();
  
      }
  }
  </code></pre>