title: Can i access Argument that a BackgroundWorker was started with when it completes?
body: <p>When i start a <code>BackgroundWorker</code> i can pass an arbitrary <em>argument</em>:</p>
  
  <pre><code>backgroundWorker1.RunWorkerAsync(someStuff);
  </code></pre>
  
  <p>The intended use is that this arbitrary argument is supplied to the <code>DoWork</code> method:</p>
  
  <pre><code>private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
  {
     Object someStuff = e.Argument;
     ...
  }
  </code></pre>
  
  <p>Now i would like that same argument back during the <em>Complete</em> callback:</p>
  
  <pre><code>private void backgroundWorker1_RunWorkerCompleted(object sender, 
                         RunWorkerCompletedEventArgs e)
  {
      Object myStuff = e.Argument;
      ...
  }
  </code></pre>
  
  <p>Except that that <strong>is no</strong> <code>e.Argument</code>.</p>
  
  <p>There <em>is</em> a <code>UserState</code>: </p>
  
  <pre><code>private void backgroundWorker1_RunWorkerCompleted(object sender, 
                          RunWorkerCompletedEventArgs e)
  {
      Object myStuff = e.UserState;
      ...
  }
  </code></pre>
  
  <p>But it's a known bug that <code>UserState</code> is never set, or settable, to anything.</p>
  
  <p>So what's a good workaround?</p>
  
  <h2>Bonus Reading</h2>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/4310166/how-do-you-set-the-userstate-in-the-runworkercompletedeventargs-object">How do you set the UserState in the RunWorkerCompletedEventArgs object?</a></li>
  </ul>