title: Getting property values of list of child objects
body: <p>Let's say I have a <code>Car</code> class with some properties. One of the properties is an <code>IEnumerable</code> of another class, <code>Passenger</code>, with it's own properties.</p>
  
  <pre><code>public class Car
  {
     public string Engine { get; set; }
     public int Wheels { get; set; }
     public IEnumerable&lt;Passenger&gt; Passengers { get; set }
  }
  </code></pre>
  
  <p>I am able to get the values of the Engine and Wheels properties (and all others such properties). However, I can't figure out how to get the properties of all the <code>Passenger</code> objects. Here's what I'm doing to get the property values of a <code>Car</code> object:</p>
  
  <pre><code>Type type = car.GetType();
  PropertyInfo[] properties = type.GetProperties();
  
  foreach (PropertyInfo property in properties)
  {
     object carValue = property.GetValue(car, null); 
     Console.WriteLine(carValue.ToString());
  }
  </code></pre>
  
  <p>This obviously doesn't give me the <code>Passenger</code> properties, but outputs something like this instead:</p>
  
  <pre><code>System.Collections.GenericList'1[Passenger]
  </code></pre>
  
  <p>How do I grab all the property values of every <code>Passenger</code> in the <code>car.Passengers</code> list?</p>