Iterating Trough Nodes
The Node Iterator allows you to traverse through the nodes without writing recursive code. Nodes are visited one by one starting from a specified node down to the last node contained within a tree.
The image below illustrates the sequence in which nodes are processed.
To iterate through nodes, do the following.
Create a new instance of the TreeListNodeIterator class. Multiple constructors allow you to specify a start node or a collection of nodes, along with whether or not to process only visible nodes.
NOTE
If you have specified a collection of nodes, then those nodes are processed starting from the first node within that specified collection.
Use the TreeListNodeIterator.MoveNext method to iterate through nodes. The currently processed node is returned by the TreeListNodeIterator.Current property. Each time the TreeListNodeIterator.MoveNext method is called, the Node Iterator moves to the next node in the hierarchy and updates the TreeListNodeIterator.Current property. If the current node is the last node, the TreeListNodeIterator.MoveNext method returns false.
To reset the Node Iterator to its initial state, call the TreeListNodeIterator.Reset method.