Generic Tree Data Structure
public class TreeNode<T> { public TreeNode() { Children = new List<TreeNode<T>>(); } public void AddChild(TreeNode<T> item) { item.Parent = this; Children.Add(item); } public List<TreeNode<T>> Children { get; set; } public TreeNode<T> Parent { get; set; } public T Data { get; set; } public bool IsLeaf { get { return !Children.Any(); } } }