How loop sub classes properties from the main class?
<p>How loop sub classes properties from the main class?</p>

<pre><code>public class GroupA
{
  public string FullName = "", BirthDay = "";
}
public class GroupB
{
  public string Email = "";
}
public class GroupC
{
  public string Phone;
}

public class MainGroup
{
  public GroupA GroupA;
  public GroupB GroupB;
  public GroupC GroupC;
}


    protected void Page_Load(object sender, EventArgs e)
    {

      GroupA  NewGroupA = new GroupA();
              NewGroupA.FullName="TEST MASTER";
              NewGroupA.BirthDay="02/20/1984";
      GroupB  NewGroupB = new GroupB();
              NewGroupB.Email="noreply@test.com"; 
      GroupC  NewGroupC=new GroupC();
              NewGroupC.Phone="555 123 4567";

      //Assign new class instances to the main class
      MainGroup NewMainGroup= new MainGroup();
                NewMainGroup.GroupA=NewGroupA;
                NewMainGroup.GroupB=NewGroupB;                 
                NewMainGroup.GroupC=NewGroupC;

      //Loop through the main class

      foreach (var Group in typeof(MainGroup).GetFields())
      {
        Response.Write("&lt;BR&gt;MainGroupName=  " + Group.Name + " Value=  " + Group.GetValue(NewMainGroup).ToString());
        //PROBLEM IS HERE. Can't loop through the subclass We need to display the GroupA, GroupB, GroupC below.
        foreach (var SubGroup in Group)
        {
          Response.Write("&lt;BR&gt;");
        }


      }
}
</code></pre>
