XMLNodes.GetEnumerator Method (2007 System)
Gets the enumerator for the XMLNodes control.
Namespace: Microsoft.Office.Tools.Word
Assembly: Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)
Syntax
'Declaration
Public Function GetEnumerator As IEnumerator
'Usage
Dim instance As XMLNodes
Dim returnValue As IEnumerator
returnValue = instance.GetEnumerator()
public IEnumerator GetEnumerator()
public:
IEnumerator^ GetEnumerator()
public function GetEnumerator() : IEnumerator
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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.