RecognitionAlternates.GetEnumerator Method
RecognitionAlternates.GetEnumerator Method |
Returns an object that implements the System.Collections.IEnumerator interface that can iterate through the RecognitionAlternate objects within the RecognitionAlternates collection.
Definition
Visual Basic .NET Public Function GetEnumerator() As RecognitionAlternatesEnumerator C# public RecognitionAlternatesEnumerator GetEnumerator(); Managed C++ public: RecognitionAlternatesEnumerator* GetEnumerator();
Return Value
Microsoft.Ink.RecognitionAlternates.RecognitionAlternatesEnumerator. Returns an object that implements the IEnumerator interface that can iterate through the RecognitionAlternate objects within the RecognitionAlternates collection.
Examples
[C#]
These C# examples show two ways to iterate over the RecognitionAlternates collection and add the string representation for each RecognitionAlternate object in the RecognitionAlternate collection, theRecognitionAlternates, to a ListBox control, theListBox.
This C# example gets the IEnumerator for the RecognitionAlternates collection.
ListBox theListBox = new ListBox(); // Version using GetEnumerator() RecognitionAlternatesEnumerator theRecognitionAlternatesEnumerator = theRecognitionAlternates.GetEnumerator(); while (theRecognitionAlternatesEnumerator.MoveNext()) { RecognitionAlternate theRecognitionAlternate = theRecognitionAlternatesEnumerator.Current; theListBox.Add(theRecognitionAlternate.ToString()); }
This C# example uses the
foreach
statement, which calls the GetEnumerator method in internal code that the compiler generates to support the statement.ListBox theListBox = new ListBox(); // Version using foreach foreach (RecognitionAlternate theRecognitionAlternate in theRecognitionAlternates) { theListBox.Items.Add(theRecognitonAlternate.ToString()); }
[VB.NET]
These Microsoft® Visual Basic® .NET examples show two ways to iterate over the RecognitionAlternates collection and add the string representation for each RecognitionAlternate object in the RecognitionAlternate collection, theRecognitionAlternates, to a ListBox control, theListBox.
This Visual Basic .NET example gets the IEnumerator for the RecognitionAlternates collection.
Dim theListBox As ListBox theListBox.Clear() 'Version using GetEnumerator() Dim theRecognitionAlternate As RecognitionAlternate Dim theRecognitionAlternatesEnumerator As IEnumerator = theRecognitionAlternates.GetEnumerator() While (theRecognitionAlternatesEnumerator.MoveNext()) theRecognitionAlternate = theRecognitionAlternatesEnumerator.Current() theListBox.Add(theRecognitionAlternate.Name) End While
This Visual Basic .NET example uses the
For Each
statement, which only the GetEnumerator method in internal code that the compiler generates to support the statement.Dim theListBox As ListBox 'Version using For Each For Each theRecognitionAlternate As RecognitionAlternate In theRecognitionAlternates theListBox.Items.Add(theRecognitionAlternate.Name) Next
See Also