using System.Collections.Generic;
public static void Main()
Console.WriteLine("Hello World");
public Customer Customer;
public Dictionary<int, TreeNode> Children;
public TreeNode(Customer cust)
public TreeNode(Customer cust, Customer par)
public TreeNode(Customer cust, Customer par, TreeNode[] list)
foreach(var item in list)
this.Children.Add(item.Customer.Id, item);
public void AddChild(TreeNode[] list)
foreach(var item in list)
this.Children.Add(item.Customer.Id, item);
public void AddChild(TreeNode nd)
this.Children.Add(nd.Customer.Id, nd);
Dictionary<int, TreeNode> tree;
public void AddNode(TreeNode parent, TreeNode child)
if(parent.Parent == null)
tree.Add(child.Customer.Id, child);
TreeNode parentNode = FindParentNode(parent, tree);
parentNode.AddChild(child);
public TreeNode FindParentNode(TreeNode parent, Dictionary<int, TreeNode> list)
list.TryGetValue(parent.Customer.Id, out theNode);
foreach(var item in tree.Values)
theNode = FindParentNode(parent, item.Children);
public int Id {get; set;}
public string Name {get; set;}