title: Easy one? Access an object's property by using a variable in C#
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/798567/property-name-and-need-its-value">Property Name and need its value</a>  </p>
  </blockquote>
  
  <p>Hi,</p>
  
  <p>This one should be easy for most people.
  I'd like to access a normal variable in an object (let's say example) by using a variable value.</p>
  
  <p>E.g.: I have a an array with a list of variable names and I want to get the information from the object by using them. Obviously this is wrong:</p>
  
  <pre><code>string[] variable_names = new string[] {"name", "surname"};
  myObject.variable_names[0] = 1; 
  myObject.variable_names[1] = 1;
  </code></pre>
  
  <p>In other languages (not C#) I use:</p>
  
  <pre><code>myObject[variable_names[0]] = 1; 
  </code></pre>
  
  <p>I know the example looks stupid but it was just a way of explaining it.</p>
  
  <p>Thanks in advance :)</p>