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 AnalysisAlternateCollectionEnumerator
'Usage
Dim instance As AnalysisAlternateCollection
Dim returnValue As AnalysisAlternateCollectionEnumerator

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

Return Value

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

Example

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 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

AnalysisAlternateCollection Class
AnalysisAlternateCollection Members
System.Windows.Ink Namespace