Tablets.GetEnumerator Method
Tablets.GetEnumerator Method |
Returns an object that implements the System.Collections.IEnumerator interface and that can iterate through the Tablet objects within the Tablets collection.
Definition
Visual Basic .NET Public Function GetEnumerator() As TabletsEnumerator C# public TabletsEnumerator GetEnumerator(); Managed C++ public: TabletsEnumerator* GetEnumerator();
Return Value
Microsoft.Ink.Tablets.TabletsEnumerator. Returns an object that implements the IEnumerator interface and that can iterate through the Tablet objects within the Tablets collection.
Examples
[C#]
These C# examples show two ways to iterate over the Tablets collection, theTablets, and get the name for each Tablet object in theTablets.
This C# example gets the IEnumerator for the Tablets collection.
ArrayList theArrayList = new ArrayList(); // Version using GetEnumerator() IEnumerator theTabletsEnumerator = theTablets.GetEnumerator(); while (theTabletsEnumerator.MoveNext()) { Tablet theTablet = (Tablet) theTabletsEnumerator.Current; theArrayList.Add(theTablet.Name) }
This C# example uses the
foreach
statement, which calls the GetEnumerator method in internal code that the compiler generates to support the statement.ArrayList theArrayList = new ArrayList(); // Version using foreach foreach (Tablet theTablet in theTablets) { theArrayList.Add(theTablet.Name); }
[VB.NET]
These Microsoft® Visual Basic® .NET examples show two ways to iterate over the Tablets collection, theTablets, and get the name for each Tablet object in theTablets.
This Visual Basic .NET example gets the IEnumerator for the Tablets collection.
Dim theArrayList As New ArrayList() Dim theTablet as Tablet 'Version using GetEnumerator() Dim theTabletsEnumerator as IEnumerator = theTablets.GetEnumerator() While (theTabletsEnumerator.MoveNext()) theTablet = theTabletsEnumerator.Current theArrayList.Add(theTablet.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.Dim theArrayList As New ArrayList() Dim theTablet As Tablet 'Version using For Each For Each theTablet In theTablets theArrayList.Add(theTablet.Name) Next
See Also