title: Cancel out of DoWork and fall into RunWorkerCompleted
body: <p>I have a <code>BackgroundWorker</code> in a WPF application. If a condition is true, I want to immediately stop processing the <code>_DoWork</code> method and go straight to the <code>_RunWorkerCompleted</code>.  I'm using <code>.CancelAsync</code>, but the code after this point continues to execute.  </p>
  
  <p>How can I cancel out of my <code>_DoWork</code> and fall into <code>_RunWorkerCompleted</code>?</p>
  
  <p>Example:</p>
  
  <pre><code>private BackgroundWorker step1 = new BackgroundWorker();
  
  public MyWindow()
  {
      InitializeComponent();
      step1.WorkerSupportsCancellation = true;
      step1.DoWork += new DoWorkEventHandler(step1_DoWork);
      step1.RunWorkerCompleted += new RunWorkerCompletedEventHandler(step1_RunWorkerCompleted);
  }
  
  private void step1_DoWork(object sender, DoWorkEventArgs e)
  {
      if (someCondition)
      {
          step1.CancelAsync();                
      }
      // code I do not want to execute
  }
  
  private void step1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
  {
      // I want to jump here from the cancel point
  }
  </code></pre>