title: How to get property name and its value?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/987982/c-sharp-how-can-i-get-the-value-of-a-string-property-via-reflection">C# How can I get the value of a string property via Reflection?</a>  </p>
  </blockquote>
  
  
  
  <pre><code>public class myClass
  {
      public int a { get; set; }
      public int b { get; set; }
      public int c { get; set; }
  }
  
  
  public void myMethod(myClass data)
  {
      Dictionary&lt;string, string&gt; myDict = new Dictionary&lt;string, string&gt;();
      Type t = data.GetType();
      foreach (PropertyInfo pi in t.GetProperties())
      {
          myDict[pi.Name] = //...value appropiate sended data.
      }
  }
  </code></pre>
  
  <p>Simple class with 3 <code>properties</code>. I send object of this class.
  How can I i loop get all <code>property names</code> and its values e.g. to one <code>dictionary</code>?</p>