title: Using a nested class to pass multiple arguments into a backgroundworker
body: <p>I'm trying to use a nested class to get two classes to pass into a single argument so I can send it to a backgroundworker. Thus far, I've managed to pass single arguments into a backgroundworker but I'm yet to do it with a nested class where I end up passing both or my desired classes into the same argument. So far here is some of the code I'm using: </p>
  
  <p>This is the Nested Class I'm attempting to use:</p>
  
  <pre><code>public class MyBackGroundWorkerObject
  {
      public class TimeZone
      {
          public string Zone;
  
          public int difference;
  
          public override string ToString()
          {
              return Zone;
          }
      }
  
      public class AccountName
      {
          public string AccountSid;
          public string AuthToken;
          public string Name;
          public override string ToString()
          {
              return Name;
          }    
      }
  
  }
  </code></pre>
  
  <p>Here's an example of one of the classes in action: </p>
  
  <pre><code>MyBackGroundWorkerObject.AccountName acct = new MyBackGroundWorkerObject.AccountName();
          //AccountName acct = new AccountName();
          acct.AccountSid = "abcd";
          acct.AuthToken = "xyz";
          acct.Name = "Potato";
          ddlAccounts.Items.Add(acct);
  
  MyBackGroundWorkerObject.TimeZone region = new MyBackGroundWorkerObject.TimeZone();
          //TimeZone region = new TimeZone();
          region.Zone = "UTC";
          region.difference = 0;
          comboBox1.Items.Add(region);
  </code></pre>
  
  <p>And here's the part where I'm utterly confused, I'd like to be able to use both of these when calling from the Window's Form from where it's retrieving some of the entered data. I'm not sure on how to get both of these classes to work in conjuction where I can send them both at the same time to the backgroundworker: </p>
  
  <pre><code>MyBackGroundWorkerObject myBackGroundWorker1 = new MyBackGroundWorkerObject();
  object obj = ddlAccounts.SelectedItem;
  
              MyBackGroundWorkerObject.AccountName acct = obj as MyBackGroundWorkerObject.AccountName; 
  backgroundWorker1.RunWorkerAsync(acct);
  </code></pre>