Cursors.GetEnumerator Method
Returns an object that implements the System.Collections.IEnumerator interface and that can iterate through the Cursor objects within the Cursors collection.
Namespace: Microsoft.Ink
Assembly: Microsoft.Ink (in microsoft.ink.dll)
Syntax
'Declaration
Public Function GetEnumerator As CursorsEnumerator
'Usage
Dim instance As Cursors
Dim returnValue As CursorsEnumerator
returnValue = instance.GetEnumerator
public CursorsEnumerator GetEnumerator ()
public:
CursorsEnumerator^ GetEnumerator ()
public CursorsEnumerator GetEnumerator ()
public function GetEnumerator () : CursorsEnumerator
Not applicable.
Return Value
Returns an object that implements the System.Collections.IEnumerator interface and that can iterate through the Cursor objects within the Cursors collection.
Example
These C# examples show two ways to iterate over the Cursors collection and get the name for each Cursor object in the InkCollector object, theInkCollector
. The Cursors collection is returned by the InkCollector.Cursors property.
This C# example gets the System.Collections.IEnumerator for the Cursors collection in the InkCollector object, theInkCollector
.
// Version using GetEnumerator()
ArrayList names = new Arraylist();
IEnumerator ienum = theInkCollector.Cursors.GetEnumerator();
while (ienum.MoveNext())
{
Cursor theCursor = (Cursor) ienum.Current;
names.Add(theCursor.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 names = new ArrayList();
// Version using foreach
foreach (Cursor theCursor in theInkCollector.Cursors)
{
names.Add(theCursor.Name);
}
These Microsoft® Visual Basic® .NET examples show two ways to iterate over the Cursors collection and get the name for each Cursor object in the InkCollector object, theInkCollector
. The Cursors collection is returned by the InkCollector.Cursors property.
This Visual Basic .NET example gets the System.Collections.IEnumerator for the Cursors collection in the InkCollector object, theInkCollector
.
'Version using GetEnumerator()
Dim names As New ArrayList()
Dim theCursor as Cursor
Dim ienum as IEnumerator = theInkCollector.Cursors.GetEnumerator()
While (ienum.MoveNext())
theCursor = ienum.Current
names.Add(theCursor.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.
'Version using For Each
Dim names As New ArrayList()
Dim theButton as CursorButton
For Each theCursor In theInkCollector.Cursors
names.Add(theCursor.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
Cursors Class
Cursors Members
Microsoft.Ink Namespace
Cursor
InkCollector.Cursors