title: How to initialize an array of type another class?
body: <p>I am trying to initialise values to the children array in Rootobject but it gave me error.
  - I tried t make an object of class Child but it did not work either, I just need to know how to set values to the array of type another class which contains other values. Your help would be appreciated.</p>
  
  <pre><code>public class Rootobject{
  
     public Child[] children { get; set; }
     public Data data { get; set; }
     public string id { get; set; }
     public string name { get; set; }
  }
  public class Data{
     //  public string name { get; set; }
  }
  public class Child{
     public Child1[] children { get; set; }
     public Data1 data { get; set; }
     public string id { get; set; }
     public string name { get; set; }
  }
  
  public class Data1{
  
  public int playcount { get; set; }
  public int area { get; set; }
  }
  
  public class Child1{
  
  public object[] children { get; set; }
  public Data2 data { get; set; }
  public string id { get; set; }
  public string name { get; set; }
  }
  
  public class Data2{
  
  public string playcount { get; set; }
  public string color { get; set; }
  public string image { get; set; }
  public int area { get; set; }
  }
  </code></pre>
  
  <p>this is where I initialise the values (what should i write in children):</p>
  
  <pre><code>var RegisteredUsers = new List&lt;Rootobject&gt;();
  RegisteredUsers.Add(new Rootobject() { children = { }, data = { }, 
                                         id = "102", name = "zaki" });
  </code></pre>