title: Parameter not shared between C# events
body: <p>I'm trying to control a form using DataSelector and button.</p>
  
  <pre><code>public void DataSelector_SelectedIndexChanged(object sender, EventArgs e) {
      switch (DataSelector.SelectedIndex) {
          case 0:
              byte[] param1 = {
                  0x00, 0x01
              };
              //some code here 
              break;
          case 1:
              byte[] param1 = {
                  0x00, 0x02
              };
              //some code here 
              break;
      }
  }
  private void button1_Click(object sender, EventArgs e) {
      Dictionary &lt; string, object &gt; postParameters = new Dictionary &lt; string, object &gt; ();
  
      postParameters.Add("param1", param1);
  }
  </code></pre>
  
  <p>However this gives me error message,param1 does not exist in the current context.
  I have tried declare param1 public,its ok to declare outside as </p>
  
  <pre><code>public byte[] param1={0x00,0x01};
  </code></pre>
  
  <p>but when I set <code>param1={0x00,0x02};</code> in Datasector event,it says got syntax error,missing expression term { , </p>
  
  <p>Adding <code>DataSelector_SelectedIndexChanged(sender, e);</code> in button1 click event also not helping...</p>
  
  <p>Can anyone tell me what happened?
  Thanks!</p>