private static void CloseAllNodes(HierarchyNode node) { for (HierarchyNode n = node.FirstChild; n != null; n = n.NextSibling) { if (n.FirstChild != null) { CloseAllNodes(n); } n.Close(); } }