title: Get properties and values from unknown object
body: <p>From the world of PHP I have decided to give C# a go. I've had a search but can't seem to find the answer of how to do the equivalent to this.</p>
  
  <pre><code>$object = new Object();
  
  $vars = get_class_vars(get_class($object));
  
  foreach($vars as $var)
  {
      doSomething($object-&gt;$var);
  }
  </code></pre>
  
  <p>I basically have a List of an object. The object could be one of three different types and will have a set of public properties. I want to be able to get a list of the properties for the object, loop over them and then write them out to a file.
  I'm thinking this has something to do with c# reflection but it's all new to me.</p>
  
  <p>Any help would be greatly appreciated.</p>