title: Referencing a field with a variable
body: <p>I was wondering if it was possible to referance a class field via variable.  like so:</p>
  
  <pre><code>int variable = 0;
  while (variable &gt; 3)
  {
     class._fieldvariable = something;
     i++
  }
  </code></pre>
  
  <p>where if I have fields: _field1, _field2, _field3 I can iterate through them all.</p>
  
  <p>The main reason for doing this is I have an sql query that will append multiple records and I'd rather not have to do all the parameters multiple times but rather something like this:</p>
  
  <pre><code>while (i &lt; 4)
  }
     command.Parameters.AddWithValue("@Alpha1", _alphai01.ToString());
     i++
  }
  </code></pre>
  
  <p>to let me set parameters 3 times with _alpha101, _alpha201 and _alpha301 are used for three different queries.</p>
  
  <p>thanks!</p>