Share via


ContextNodeCollection.GetEnumerator Method

Returns an object that both implements the IEnumerator interface, and iterates through the ContextNode objects within the ContextNodeCollection.

Namespace:  System.Windows.Ink
Assembly:  IAWinFX (in IAWinFX.dll)

Syntax

'Declaration
Public Function GetEnumerator As ContextNodeCollection.ContextNodeCollectionEnumerator
'Usage
Dim instance As ContextNodeCollection 
Dim returnValue As ContextNodeCollection.ContextNodeCollectionEnumerator 

returnValue = instance.GetEnumerator()
public ContextNodeCollection.ContextNodeCollectionEnumerator GetEnumerator()
public:
ContextNodeCollection.ContextNodeCollectionEnumerator^ GetEnumerator()
public function GetEnumerator() : ContextNodeCollection.ContextNodeCollectionEnumerator

Return Value

Type: System.Windows.Ink.ContextNodeCollection.ContextNodeCollectionEnumerator
An object that both implements the IEnumerator interface, and iterates through the ContextNode objects within the ContextNodeCollection.

Examples

The examples in this section show two ways to iterate through a ContextNodeCollection, getting the identifiers for each of the lines in an InkAnalyzer named theInkAnalyzer.

The following example gets the IEnumerator for the ContextNodeCollection (named lines).

Dim ids As New ArrayList()
' Version using GetEnumerator() 
Dim lines As ContextNodeCollection = theInkAnalyzer.FindNodesOfType(ContextNodeType.Line)
Dim ienum As IEnumerator = lines.GetEnumerator()
While ienum.MoveNext()
    Dim id As Guid = CType(ienum.Current, ContextNode).Id
    ids.Add(id)
End While
ArrayList ids = new ArrayList();
// Version using GetEnumerator()
ContextNodeCollection lines =
    theInkAnalyzer.FindNodesOfType(ContextNodeType.Line);
IEnumerator ienum = lines.GetEnumerator();
while (ienum.MoveNext())
{
    Guid id = ((ContextNode)ienum.Current).Id;
    ids.Add(id);
}

The following example uses the foreach statement, which calls the GetEnumerator method (contained in internal code generated by the compiler) to support the statement.

' Version using foreach 
Dim line As ContextNode
For Each line In  lines
    Dim id As Guid = line.Id
    ids.Add(id)
Next line
// Version using foreach 
foreach (ContextNode line in lines)
{
    Guid id = line.Id;
    ids.Add(id);
}

Platforms

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

ContextNodeCollection Class

ContextNodeCollection Members

System.Windows.Ink Namespace