Compartir a través de


Recognizers.GetEnumerator Method

Returns an object that implements the System.Collections.IEnumerator interface and that can iterate through the Recognizer objects within the Recognizers collection.

Namespace: Microsoft.Ink
Assembly: Microsoft.Ink (in microsoft.ink.dll)

Syntax

'Declaration
Public Function GetEnumerator As RecognizersEnumerator
'Usage
Dim instance As Recognizers
Dim returnValue As RecognizersEnumerator

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

Return Value

Returns an object that implements the System.Collections.IEnumerator interface and that can iterate through the Recognizer objects within the Recognizers collection.

Example

These C# examples show two ways to iterate over the Recognizers collection and get the name for each Recognizer object in the Recognizers collection, theRecognizers.

This C# example gets the System.Collections.IEnumerator for the Recognizers collection.

Recognizers theRecognizers = new Recognizers();
ArrayList theArrayList = new ArrayList(theRecognizers.Count);

//Version using IEnumerator
IEnumerator theEnumerator = theRecognizers.GetEnumerator();
while(theEnumerator.MoveNext())
    {

        Recognizer theRecognizer = (Recognizer) theEnumerator.Current;
        theArrayList.Add(theRecognizer.Name);
    }

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

Recognizers theRecognizers = new Recognizers();
ArrayList theArrayList = new ArrayList();
//Version using foreach
foreach (Recognizer theRecognizer in theRecognizers)
    {
        theArrayList.Add(theRecognizer.Name);
    }

These Microsoft® Visual Basic® .NET examples show two ways to iterate over the Recognizers collection and get the name for each Recognizer object in the Recognizer object, theRecognizer.

This Visual Basic .NET example gets the System.Collections.IEnumerator for the Recognizers collection.

Imports Microsoft.Ink
...
  Sub IEnumerator_Method()
    'Version using GetEnumerator()
    Dim theArrayList As New ArrayList()
    Dim theRecognizers As New Recognizers()
    Dim theRecognizer As Recognizer

    Dim theEnumerator As IEnumerator = theRecognizers.GetEnumerator()
    While (theEnumerator.MoveNext())
        theRecognizer = theEnumerator.Current
        theArrayList.Add(theRecognizer.Name)
    End While

This Visual Basic .NET example uses the For Each statement, which calls the GetEnumerator method in internal code that the compiler generates to support the statement.

Imports Microsoft.Ink
...
'Version using For Each
Dim theArrayList As New ArrayList()
Dim theRecognizers As New Recognizers()

For Each theRecognizer In theRecognizers
    theArrayList.Add(theRecognizer.Name)
Next

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

Recognizers Class
Recognizers Members
Microsoft.Ink Namespace
Recognizer