title: BackgroundWorker why call CancelAsync()?
body: <p>I know there are a lot of questions on BWs out there, but i still felt the need to ask this question/didn't feel like i got the information i wanted... or someone has to explain this to me in a way that i can understand... i see no actual purpose to calling <code>BW.CancelAsync()</code> other than it sets the CancellationPending flag to true... </p>
  
  <p>So basically, my question is: Why call <code>CancelAsync()</code> on a BW? </p>
  
  <p>Or the same question in a different way: my code is setup this way, is this OK or should i absolutely call <code>CancelAsync()</code> in there? What purpose does <code>CancelAsync()</code> serve that this code won't handle?</p>
  
  <p>This is a bit dummed down but you get the general idea anyway.</p>
  
  <pre><code>void BW_DoWork(object sender, DoWorkEventArgs e)
  {
      Process_Status LastProcessed = Process_Status.None;
  
      foreach(Iteration iter in Iterations)
      {
          //global form flag set when user presses CANCEL AND ROLLBACK button...
          if (!this.IsRollBack)
          {
              try
              {
                  //DO SOME WORK HERE
                  LastProcessed = Process_Status.SomethingSucceeded;
              }
              catch
              {
                  this.LastFail = Process_Status.SomethingFailed;
                  //this, for me, cancels the thread and runs RunWorkerCompleted...
                  e.Cancel = true;
              }
          }
          else
          {
              this.LastFail = LastProcessed;
              //this, for me, cancels the thread and runs RunWorkerCompleted...
              e.Cancel = true;
          }
      }
  }
  </code></pre>
  
  <p>And then in the RunWorkerCompleted...</p>
  
  <pre><code>void BW_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
  {
      if (e.Cancelled)
      {
          switch(this.LastFail)
          {
               //DO SOMETHING MEANINGFUL HERE BASED ON GLOBAL STATUS...
          }
      }
  }
  </code></pre>
  
  <p>Can someone help me understand the purpose of <code>CancelAsync()</code> better?</p>