title: Parallel forEach search file
body: <p>I have a program that contains 2 listbox, this program is bassed to search file, and then compare with a <code>StopWatch</code> the difference to use <code>AsyncAwait</code> and TPL... The first listbox does the function using  <code>AsyncAwait</code> (I don't know if it's the better way to do but it works, see my code below)</p>
  
  <pre><code>private async void button1_Click(object sender, EventArgs e)
  {
      Stopwatch stopWatch = new Stopwatch();
      foreach (string d in Directory.GetDirectories(@"C:\Visual Studio Projectes\Hash\AsyncAwait\Carpetes"))
      {    
          foreach (string s in Directory.GetFiles(d))
          {
              stopWatch.Start();
              listBox1.Items.Add(s);
              await Task.Delay(1);
              btIniciar1.Enabled = false;
          }
      }
      btIniciar1.Enabled = true;
      stopWatch.Stop();
      TimeSpan ts = stopWatch.Elapsed;
      textBox1.Text = ts.ToString("mm\\:ss\\.ff") + (" minuts");
  }
  </code></pre>
  
  <p>And then in my second listbox is where I'm stuck, I don't know how to implement the <code>Parallel.ForEach</code> to act like <code>async</code>,  what's the better way to do this? I can't find the way to use TPL in this case to do the same as my first listbox, could you help me please?</p>