public bool IsLeaf(TreeNode node) { if (node != null) { return(TreeNodeUtilities.IsLeaf(node)); } return(false); }
public int Compare(object x, object y) { TreeNode tx = (TreeNode)x; TreeNode ty = (TreeNode)y; bool txIsLeaf = TreeNodeUtilities.IsLeaf(tx); bool tyIsLeaf = TreeNodeUtilities.IsLeaf(ty); int value = 0; if (txIsLeaf == tyIsLeaf) { value = tx.Text.CompareTo(ty.Text); } else { value = txIsLeaf ? 1 : -1; } return(value); }