title: Assign a value to an object variable when the object variable name is in another variable
body: <p>I have a class like so:</p>
  
  <pre><code>Class A
  {
       int a;
       string b;
       .....
       .....
       ......//up to 200
  }
  </code></pre>
  
  <p>And I need to set the value of a or b from a variable, say:</p>
  
  <pre><code>var varValue;
  </code></pre>
  
  <p>So, the variable <code>varValue</code> is accompanied by another variable:</p>
  
  <pre><code>string varName='a';
  </code></pre>
  
  <p>So, I need to create an object and assign the value such that if <code>varName</code> is 'a', the corresponding <code>varValue</code> is assigned to <code>int a;</code> and vice versa if <code>varName</code> is 'b'</p>
  
  <p>I need this because I have a service which returns just the property name and its corresponding value as a tuple and I need to put this in a model, but the tuple may come in any order and I need to assign the value to the object properly.</p>
  
  <p>And I dont want to use if-else since I have around 200 variables in my class.</p>