title: How to retrieve member fields from nested classes recursively in C#
body: <p>I am calling a method <code>GetEmployee()</code> which returns the value of type <code>Employee</code> and stored in <code>emp</code> variable.</p>
  
  <pre><code>var emp = GetEmployee();
  </code></pre>
  
  <p>I need to retrieve all the member fields of the Employee class like age, name and also members of nested classes like</p>
  
  <pre><code>[Address-&gt;DoorNum,Street,Zip]
  [Phone-&gt;mobile,homePhone],
  [Dependents-&gt;name,age,
  [phone-&gt;mobile,homePhone]] 
  </code></pre>
  
  <p>recursively from the <code>emp</code> variable.</p>
  
  <p>The class structure is as below:</p>
  
  <pre><code>class Employee
  {
   int age;
   string name
   Address address;
   Phone[] phones;
   Dependents[] dependents;
  }
  
  class Address
  {
   int DoorNum;
   string Street;
   int Zip;
  }
  
  class Phone
  {
   string mobile;
   string homePhone;
  }
  
  class Dependents
  {
   string name;
   int age;
   Phone depPhone;
  }
  </code></pre>
  
  <p>Can you help me how can I achieve this?</p>