title: C# Background Worker to process a List one by one
body: <p>I have a list of Contacts as follows.</p>
  
  <pre><code>List&lt;string&gt; Numbers = new List&lt;string&gt;();
  </code></pre>
  
  <p>This list can have any length of numbers in it. I want to send message to these numbers one by one and also report the progress to the user on a WinForm so I have a method like this.</p>
  
  <pre><code>private void ProcessBroadcast()
          {
              foreach (var number in Numbers)
                  {
                      //Send a Message here
                      messageWorker.RunWorkerAsync(message);
                  }
          } 
  </code></pre>
  
  <p>Since sending a message takes time so we opted to use BackgroundWorker to send a message. Now here the issue is we want to continue to send message to the next number in the foreach loop only when Background worker has completed. </p>
  
  <p>I have implemented </p>
  
  <blockquote>
    <p>messageWorker_DoWork</p>
  </blockquote>
  
  <p>&amp; </p>
  
  <blockquote>
    <p>messageWorker_RunWorkerCompleted</p>
  </blockquote>
  
  <p>and I am able to get the Number in messageWorker_RunWorkerCompleted method. I have done my research but couldn't find anything related to this.</p>