Share via


ContextNodeBaseCollection.GetEnumerator Method

Returns an object that both implements the IEnumerator interface and can iterate through the ContextNodeBase objects within the ContextNodeBaseCollection.

Namespace:  System.Windows.Ink.AnalysisCore
Assembly:  IACore (in IACore.dll)

Syntax

'Declaration
Public Function GetEnumerator As ContextNodeBaseCollection.ContextNodeBaseCollectionEnumerator
'Usage
Dim instance As ContextNodeBaseCollection 
Dim returnValue As ContextNodeBaseCollection.ContextNodeBaseCollectionEnumerator 

returnValue = instance.GetEnumerator()
public ContextNodeBaseCollection.ContextNodeBaseCollectionEnumerator GetEnumerator()
public:
ContextNodeBaseCollection.ContextNodeBaseCollectionEnumerator^ GetEnumerator()
public function GetEnumerator() : ContextNodeBaseCollection.ContextNodeBaseCollectionEnumerator

Return Value

Type: System.Windows.Ink.AnalysisCore.ContextNodeBaseCollection.ContextNodeBaseCollectionEnumerator
An object that both implements the IEnumerator interface and can iterate through the ContextNodeBase objects in the ContextNodeBaseCollection.

Examples

The examples in this section show two ways to iterate over a ContextNodeBaseCollection and get the identifiers for all lines in an InkAnalyzerBase named theInkAnalyzerBase.

The following example gets the IEnumerator for the ContextNodeBaseCollection, lines.

Dim ids As New ArrayList()
' Version using GetEnumerator() 
Dim lines As ContextNodeBaseCollection = _
    theInkAnalyzerBase.FindNodesOfType(System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.Line)
Dim ienum As IEnumerator = lines.GetEnumerator()
While ienum.MoveNext()
    Dim id As Guid = CType(ienum.Current, ContextNodeBase).Id
    ids.Add(id)
End While
           ArrayList ids = new ArrayList();
            // Version using GetEnumerator()
            ContextNodeBaseCollection lines =
                theInkAnalyzer.FindNodesOfType(System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.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 GetEnumerator in internal code that the compiler generates to support the statement.

' Version using foreach 
Dim line As ContextNodeBase
For Each line In lines
    Dim id As Guid = line.Id
    ids.Add(id)
Next line
           // Version using foreach 
            foreach (ContextNodeBase 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

ContextNodeBaseCollection Class

ContextNodeBaseCollection Members

System.Windows.Ink.AnalysisCore Namespace