XMLNodes.GetEnumerator Method

Gets the enumerator for the XMLNodes control.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word (in Microsoft.Office.Tools.Word.dll)

Syntax

'Declaration
Function GetEnumerator As IEnumerator
IEnumerator GetEnumerator()

Return Value

Type: System.Collections.IEnumerator
The enumerator for the XMLNodes control.

Examples

The following code example uses the GetEnumerator method to get an enumerator for an XMLNodes collection and then iterate through the collection. This example assumes that the current document contains an XMLNodes control named SampleInsertNodes.

Private Sub EnumerateNodes()
    Dim en As System.Collections.IEnumerator = _
        Me.SampleInsertNodes.GetEnumerator()

    While en.MoveNext()
        Dim currentNode As Word.XMLNode = _
            CType(en.Current, Word.XMLNode)
        MsgBox(currentNode.BaseName)
    End While
End Sub
private void EnumerateNodes()
{
    System.Collections.IEnumerator en =
        this.SampleInsertNodes.GetEnumerator();

    while (en.MoveNext())
    {
        Word.XMLNode currentNode = (Word.XMLNode)en.Current;
        MessageBox.Show(currentNode.BaseName);
    }
}

.NET Framework Security

See Also

Reference

XMLNodes Interface

Microsoft.Office.Tools.Word Namespace