title: how to calculate execution time of a async method in c#
body: <p>So I have a Async method which does something asynchronously.</p>
  
  <pre><code>private async static void DoSomethingAsync (int i){}
  </code></pre>
  
  <p>I call it in a loop lets say 50 times.</p>
  
  <pre><code>for (int i = 0; i &lt; 50; i++)
   {
      DoSomethingAsync (i);
   }
  </code></pre>
  
  <p>At the end of loop I want to calculate total processing time, I used Stopwatch but as you can imagine it gives me wrong time as it gets called as soon as after the loop, it does not wait for the DoSomethingAsync to finish processing.  </p>
  
  <p>how to tell Stopwatch to wait for all the 50 instances of DoSomethingAsync() to finish. I have seen <a href="https://stackoverflow.com/questions/19381426/using-the-stopwatch-with-async-methods">this</a> question, but I cant use Task here.</p>