title: waiting for all asynchronous web service calls to return
body: <p>I have a desktop app (.net 3.5) which communicates with the server using classic web services.<br>
  I need to make numerous calls to web service functions, wait for them all to finish, and then proceed.  </p>
  
  <p>I'd like to do these calls in parallel; so obviously I'm looking to utilize the <code>MyFunctionAsync</code> method.<br>
  The thing is- i'm not sure how to verify that all calls have returned. I'm probably missing some simple synchronization mechanism here.  </p>
  
  <p>here's what i'd like to be able to do:  </p>
  
  <pre><code>public void DoWork()
  {
     service.MyFuncCompleted+= MyFunc_Completed;
     foreach (var i in items)
     {
        service.MyFuncAsync(i);
        syncMechanism.WaitForAnother(1);  //signal that we have to wait for 1 more task to finish
     }
     syncMechanism.WaitForAllTasksToFinsih();  //wait until specified number of tasks have finished
  
     //continue
  }
  
  public void MyFunc_Completed(EventArgs e)
  {
     //process result...
     syncMechanism.Signal(1);  //signal that 1 task has finished
  }
  </code></pre>
  
  <p>anybody know anything like this is c#?</p>