title: Get Values from Dynamic Property
body: <p>I am working on a project that makes extensive use of XML config files, and I would like to take a few things to the next level with generic implementation of shared code.</p>
  
  <p>Problem is, of my five classes, two handle a "description" grid view differently.
  This grid view shows objects of the appropriate type with various columns.</p>
  
  <p>Also of note: the data is passed via a Data Record, so the GUI does not have direct access to the source object(s).</p>
  
  <p>Here is my current "attempt" to get dynamic data, using a rather silly hack (that did not work)</p>
  
  <pre><code>GetObjectData( MyClass myObject, string[] dataToGet)
  {
      List&lt;string&gt; dataToReturn = new List&lt;string&gt;();
      foreach (string propertyName in dataToGet)
      {
         try
         {
           Label tempLabel = new Label();
           tempLabel.DataBindings.Add("Text", myObject, propertyName);
  
           dataToReturn.Add(tempLabel.Text);
         }
         catch { dataToReturn.Add(""); }
      }
  }
  </code></pre>
  
  <p>There MUST be a way to do this, but I'm not sure what it would be called, or how to approach the issue.</p>