CompositeNodeGetEnumerator Method
Provides support for the for each style iteration over the child nodes of this node.

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.11
Syntax
public IEnumerator<Node> GetEnumerator()

Return Value

Type: IEnumeratorNode

Implements

IEnumerableTGetEnumerator
Examples
Shows how to enumerate immediate children of a CompositeNode using the enumerator provided by the ChildNodes collection.
NodeCollection children = paragraph.ChildNodes;
foreach (Node child in children)
{
    // Paragraph may contain children of various types such as runs, shapes and so on.
    if (child.NodeType.Equals(NodeType.Run))
    {
        // Say we found the node that we want, do something useful.
        Run run = (Run) child;
        Console.WriteLine(run.Text);
    }
}
See Also