Share via


AnalysisAlternateCollection.GetEnumerator Method

Returns an object that implements the IEnumerator interface and iterates through the AnalysisAlternate objects within the AnalysisAlternateCollection.

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

Syntax

'Declaration
Public Function GetEnumerator As AnalysisAlternateCollection.AnalysisAlternateCollectionEnumerator
'Usage
Dim instance As AnalysisAlternateCollection 
Dim returnValue As AnalysisAlternateCollection.AnalysisAlternateCollectionEnumerator 

returnValue = instance.GetEnumerator()
public AnalysisAlternateCollection.AnalysisAlternateCollectionEnumerator GetEnumerator()
public:
AnalysisAlternateCollection.AnalysisAlternateCollectionEnumerator^ GetEnumerator()
public function GetEnumerator() : AnalysisAlternateCollection.AnalysisAlternateCollectionEnumerator

Return Value

Type: System.Windows.Ink.AnalysisAlternateCollection.AnalysisAlternateCollectionEnumerator
Returns an object that implements the IEnumerator interface and iterates through the AnalysisAlternate objects within the AnalysisAlternateCollection.

Examples

These examples show two ways to iterate through an AnalysisAlternateCollection, alternates, and collect the recognized strings into an ArrayList, recognizedStrings.

This example gets the IEnumerator.

Dim recognizedStrings As New ArrayList()
' Version using GetEnumerator() 
Dim ienum As IEnumerator = alternates.GetEnumerator()
While ienum.MoveNext()
    Dim recoString As String = CType(ienum.Current, AnalysisAlternate).RecognizedString
    recognizedStrings.Add(recoString)
End While
ArrayList recognizedStrings = new ArrayList();
// Version using GetEnumerator()
IEnumerator ienum = alternates.GetEnumerator();
while (ienum.MoveNext())
{
    String recoString =
        ((AnalysisAlternate)ienum.Current).RecognizedString;
    recognizedStrings.Add(recoString);
}

This example uses the foreach statement, which calls the GetEnumerator method in internal code that the compiler generates to support the statement.

' Version using foreach 
Dim alternate As AnalysisAlternate
For Each alternate In  alternates
    recognizedStrings.Add(alternate.RecognizedString)
Next alternate
// Version using foreach 
foreach (AnalysisAlternate alternate in alternates)
{
    recognizedStrings.Add(alternate.RecognizedString);
}

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

AnalysisAlternateCollection Class

AnalysisAlternateCollection Members

System.Windows.Ink Namespace