Aracılığıyla paylaş


XMLNodes.GetEnumerator Method

Definition

Gets the enumerator for the XMLNodes control.

public:
 System::Collections::IEnumerator ^ GetEnumerator();
public System.Collections.IEnumerator GetEnumerator ();
abstract member GetEnumerator : unit -> System.Collections.IEnumerator
Public Function GetEnumerator () As IEnumerator

Returns

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 void EnumerateNodes()
{
    System.Collections.IEnumerator en =
        this.SampleInsertNodes.GetEnumerator();

    while (en.MoveNext())
    {
        Word.XMLNode currentNode = (Word.XMLNode)en.Current;
        MessageBox.Show(currentNode.BaseName);
    }
}
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

Applies to