The TreeView.CollapseAll method collapses all the System.Windows.Forms.TreeNode objects, which includes all the child tree nodes, that are in the System.Windows.Forms.TreeView control.
The state of a System.Windows.Forms.TreeNode persists. For example, suppose that you call the TreeNode.Expand method for a root tree node. If the child tree nodes were not previously collapsed, they will appear in their previously-expanded state. Calling the TreeView.CollapseAll method ensures that all the tree nodes appear in the collapsed state.