title: AWAIT multiple file downloads with DownloadDataAsync
body: <p>I have a zip file creator that takes in a <code>String[]</code> of Urls, and returns a zip file with all of the files in the <code>String[]</code></p>
  
  <p>I figured there would be a number of example of this, but I cannot seem to find an answer to "How to download many files asynchronously and return when done"</p>
  
  <p>How do I download {n} files at once, and return the Dictionary only when all downloads are complete?</p>
  
  <pre><code>private static Dictionary&lt;string, byte[]&gt; ReturnedFileData(IEnumerable&lt;string&gt; urlList)
  {
      var returnList = new Dictionary&lt;string, byte[]&gt;();
      using (var client = new WebClient())
      {
          foreach (var url in urlList)
          {
              client.DownloadDataCompleted += (sender1, e1) =&gt; returnList.Add(GetFileNameFromUrlString(url), e1.Result);
              client.DownloadDataAsync(new Uri(url));
          }
      }
      return returnList;
  }
  
  private static string GetFileNameFromUrlString(string url)
  {
      var uri = new Uri(url);
      return System.IO.Path.GetFileName(uri.LocalPath);
  }
  </code></pre>