Share via


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 Cursors.CursorsEnumerator
'Usage
Dim instance As Cursors 
Dim returnValue As Cursors.CursorsEnumerator 

returnValue = instance.GetEnumerator()
public Cursors.CursorsEnumerator GetEnumerator()
public:
Cursors.CursorsEnumerator^ GetEnumerator()
public function GetEnumerator() : Cursors.CursorsEnumerator

Return Value

Type: Microsoft.Ink.Cursors.CursorsEnumerator
Returns an object that implements the System.Collections.IEnumerator interface and that can iterate through the Cursor objects within the Cursors collection.

Examples

These examples show two ways to iterate over the Cursors collection and get the name for each Cursor object included in the collection. The Cursors collection is returned by the InkOverlay.Cursors property.

In this example, the System.Collections.IEnumerator is obtained for the Cursors collection, and used to enumerate each item of the collection.

Dim names As ArrayList = New ArrayList()
Dim ienum As IEnumerator = mInkOverlay.Cursors.GetEnumerator()
ienum.Reset()
While ienum.MoveNext()
    Dim theCursor As Microsoft.Ink.Cursor = DirectCast(ienum.Current, Microsoft.Ink.Cursor)
    names.Add(theCursor.Name)
End While
ArrayList names = new ArrayList();
IEnumerator ienum = mInkOverlay.Cursors.GetEnumerator();
ienum.Reset();
while (ienum.MoveNext())
{
    Microsoft.Ink.Cursor theCursor = (Microsoft.Ink.Cursor)ienum.Current;
    names.Add(theCursor.Name);
}

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

Dim names As ArrayList = New ArrayList()
For Each theCursor As Microsoft.Ink.Cursor In mInkOverlay.Cursors
    names.Add(theCursor.Name)
Next
ArrayList names = new ArrayList();
foreach (Microsoft.Ink.Cursor theCursor in mInkOverlay.Cursors)
{
    names.Add(theCursor.Name);
}

Platforms

Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

Cursors Class

Cursors Members

Microsoft.Ink Namespace

Cursor

InkCollector.Cursors