title: Use reflection to get the value of a property by name in a class instance
body: <p>Lets say I have </p>
  
  <pre><code>class Person
  {
      public Person(int age, string name)
      {
          Age = age;
          Name = name; 
      }
      public int Age{get;set}
      public string Name{get;set}
  }
  </code></pre>
  
  <p>and I would like to create a method that accepts a string that contains either 
  "age" or "name" and returns an object with the value of that property.</p>
  
  <p>Like the following pseudo code:</p>
  
  <pre><code>    public object GetVal(string propName)
      {
          return &lt;propName&gt;.value;  
      }
  </code></pre>
  
  <p>How can I do this using reflection?</p>
  
  <p>I am coding using asp.net 3.5, c# 3.5 </p>