ContextNodeCollection.GetEnumerator Method
Returns an object that both implements the IEnumerator interface, and can iterate through the ContextNode objects within the ContextNodeCollection.
Namespace: Microsoft.Ink
Assembly: Microsoft.Ink.Analysis (in Microsoft.Ink.Analysis.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: Microsoft.Ink.ContextNodeCollection.ContextNodeCollectionEnumerator
An object that both implements the IEnumerator interface, and can iterate through the ContextNode objects within the ContextNodeCollection.
Examples
The examples in this section show two ways to iterate over a ContextNodeCollection and get the identifiers for all of the lines in an InkAnalyzer, theInkAnalyzer.
The following example gets the IEnumerator for the ContextNodeCollection, lines.
Dim ids As New ArrayList()
' Version using GetEnumerator()
Dim lines As ContextNodeCollection = _
theInkAnalyzer.FindNodesOfType(Microsoft.Ink.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(Microsoft.Ink.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 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 Server 2008 R2, Windows Server 2008
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