title: Passing variables to timer event in a class
body: <p>I have a method in a class that receives and returns multiple parameters from/to Form1.
  I need to use a timed event to execute some code using those parameters.
  I have arranged this simplified code to show the dynamic:</p>
  
  <pre><code>class Motor
  {
      public static System.Timers.Timer _timer;
      int valReg = 30;
  
      public void PID(decimal _actualSpeed, Decimal _speedRequest, out Decimal _pwmAuto, out decimal _preValReg)
      {
  
          _timer = new System.Timers.Timer();
          _timer.Interval = (3000);
          _timer.Elapsed += new System.Timers.ElapsedEventHandler(_timerAutoset);
          _timer.Enabled = true;
          // {....}
          _pwmAuto = valReg;
          _preValReg = valReg - 1;
      }
      static void _timerAutoset(object sender, System.Timers.ElapsedEventArgs e)
      {
          /* here I need to work with:
           _actualSpeed
           _speedRequest
           _pwmAuto
           _preValReg
          and send back the last two variables
           */
      }    
  }
  </code></pre>
  
  <p>This is how I pass and receive the variables from Form1 button :</p>
  
  <pre><code>        private void button4_Click(object sender, EventArgs e)
          {
          // some code ................
          Motor mtr = new Motor();
          mtr.PID(speedRequest, actualSpeed, out pwmAuto, out xxx);
          //..more code
  </code></pre>
  
  <p>How can I pass/get back those parameters to/from _timerAutoset event?</p>