title: how do I pass info to my main class from a child class
body: <p>I have two classes, the main from WPF and a child class called 'PersistDataToTable' inside 'PersistDataToTable.Persist' I have a loop and I want to pass that loop incrament back to the main WPF class to show in the progress bar.
  I have a backgroundworker thread running the method that hits the loop, I just don't know how to get the data back to the ReportProgress method from the backgroundworker thread.</p>
  
  <pre><code>private void PersistDataToDb(object sender, RoutedEventArgs e)
      {
          worker = new BackgroundWorker();
          worker.WorkerReportsProgress = true;
  
          worker.DoWork += delegate(object o, DoWorkEventArgs args)
              {
                  PersistDataToTable persistData = new PersistDataToTable();
                  persistData.Persist(seriesId);
  
                  worker.ReportProgress(loop incrament from persist()??);
  
              };
  
          worker.ProgressChanged += delegate(object o, ProgressChangedEventArgs args)
              { 
                  int percentage = args.ProgressPercentage;
                  progressBar.Value = percentage;
              };
  
          worker.RunWorkerAsync();
      }
  </code></pre>