public Parent() { this.c1 = new child1(); this.c2 = new child2(); this.c3 = new child3(); this.c4 = new child4(); this.c5 = new child5(); }
static void Main(string[] args) { child1 ch1 = new child1(); ch1.message(); child2 ch2 = new child2(); ch2.message(); }
public static List <parent> maketree() { List <parent> parent = new List <parent>(); parent par = new parent(); par.ParentName = "BP Chaturvedi"; par.childs = new List <child1>(); child1 ch = new child1(); ch.Name = "Vikas"; child1 ch1 = new child1(); ch.Name = "Kiran"; par.childs.Add(ch); par.childs.Add(ch1); parent par1 = new parent(); par1.ParentName = "Apke papa ka naam"; par1.childs = new List <child1>(); child1 ch3 = new child1(); ch3.Name = "unke lardke"; child1 ch4 = new child1(); ch4.Name = "unki beti"; par1.childs.Add(ch3); par1.childs.Add(ch4); parent.Add(par); parent.Add(par1); JavaScriptSerializer serialize = new JavaScriptSerializer(); string jtree = serialize.Serialize(parent); List <parent> response = (List <parent>)serialize.Deserialize(jtree, typeof(List <parent>)); return(response); }
protected void test() { child1 myChild1 = new child1(); string oldName = commonParent.GetName(myChild1); }