title: How to bind a list of objects of a class to a datagridview whose one field is again an object of some other class?
body: <p>I have following code in which i have to bind a list of objects of a class to a datagridview. In this class one field is an object of some other class which again have some fields in it.Please refer the code.</p>
  
  <pre><code>public class Test
  {
      public string m_field1_Test { get; set; }
      public string m_field2_Test { get; set; }
      public string m_field3_Test { get; set; }
      public string m_field4_Test { get; set; }
      .
      .
      public string m_field100_Test{get; set;}
      public Test1 test1obj;
  
      public Test()
      {
          m_field1_Test = "field1";
          m_field2_Test = "field2";
          m_field3_Test = "field3";
          m_field4_Test = "field4";
          .
          .
          m_field100_Test = "field100";
  
          test1obj = new Test1();
      }
  }
  
  public class Test1
  {
      public string m_field1_Test1;
      public string m_field2_Test1;
      public string m_field3_Test1; 
      .
      .
      .
      public string m_field30_Test1;   
  
      public Test1()
      {
  
          m_field1_Test1 = "field1_Test1";
          m_field2_Test1 = "field2_Test1";
          m_field3_Test1 = "field3_Test1"; 
          .
          .
          .
          m_field30_Test1 = "field30_Test1";
      }       
  }
  </code></pre>
  
  <p>On a Button click i am binding a list of Test Objects to dataGridView. Code is as follows.</p>
  
  <pre><code>   private void Button2_Click(object sender, EventArgs e)
      {
          List&lt;Test&gt; listTest = new List&lt;Test&gt;();
          Test obj;
          for (int i = 0; i &lt; 1000000; i++)
          {
              obj = new Test();
              listTest.Add(obj);
          }
          label1.Text = listTest.Count().ToString();
          dataGridView1.DataSource = listTest;
          dataGridView1.BackgroundColor = Color.Beige;                
      }
  </code></pre>
  
  <p>When i execute this much part only field1 to field4 are appearing in the datagridview. How can i bind it in such a way so that Test1 fields also appear in datagridview in format.I want output something like this.</p>
  
  <pre><code>     field1 | field2  | field3| ....field100|field1_Test1 |field2_Test1|...field30_Test1
              |         |       |             |              |            |
              |         |       |             |              |            |
              |         |       |             |              |            |
  </code></pre>
  
  <p>Can someone please tell me how to implement this functionality??</p>