protected void GetLeafLevelItems(MultiLevelItem <T> node, List <MultiLevelItem <T> > selection) { if (node == null) { return; } if (node.IsLeaf) { selection.Add(node); return; } for (int i = 0; i < node.ChildCount; ++i) { GetLeafLevelItems(node.GetChild(i), selection); } }
protected bool IsDescendentOf(MultiLevelItem <T> node1, MultiLevelItem <T> node2) { if (node1.Equals(node2)) { return(true); } if (node2.IsLeaf) { return(false); } for (int i = 0; i < node2.ChildCount; ++i) { if (IsDescendentOf(node1, node2.GetChild(i))) { return(true); } } return(false); }