title: C# Printing Properties
body: <p>I have a class like this with a bunch of properties:</p>
  
  <pre><code>class ClassName
  {
       string Name {get; set;}
       int Age {get; set;}
       DateTime BirthDate {get; set;}
  }
  </code></pre>
  
  <p>I would like to print the name of the property and it's value using the value's ToString() method and the Property's name like this:</p>
  
  <pre><code>ClassName cn = new ClassName() {Name = "Mark", Age = 428, BirthData = DateTime.Now}
  cn.MethodToPrint();
  
  // Output
  // Name = Mark, Age = 428, BirthDate = 12/30/2010 09:20:23 PM
  </code></pre>
  
  <p>Reflection is perfectly okay, in fact I think it is probably required.  I'd also be neat if it could somehow work on any class through some sort of inheritance.  I'm using 4.0 if that matters.</p>