using System.Collections.Generic;
public static void Main()
var Persons = new List<Person>();
Persons.Add(new Person("Eric"));
Persons[0].Childs = new List<Person>();
Persons[0].Childs.Add(new Person("Tom"));
Persons[0].Childs.Add(new Person("John"));
Persons[0].Childs[0].Childs = new List<Person>();
Persons[0].Childs[0].Childs.Add(new Person("Bill"));
Persons.Add(new Person("John"));
public Person(string name)
public string Name {get;set;}
public List<Person> Childs{get;set;}
public static void DisplayPerson(List<Person> persons, int level = 0)
foreach (Person item in persons)
Console.WriteLine("-" + item.Name + ", Level" + level);
DisplayPerson(item.Childs, level);