Share via


CustomStrokes.CustomStrokesEnumerator.Reset Method

Resets the enumerator index to the beginning of the CustomStrokes collection.

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

Syntax

'Declaration
Public Sub Reset
'Usage
Dim instance As CustomStrokes.CustomStrokesEnumerator

instance.Reset()
public void Reset()
public:
virtual void Reset() sealed
public final function Reset()

Implements

IEnumerator.Reset()

Remarks

The CustomStrokes.CustomStrokesEnumerator class supports iterating over a CustomStrokes collection and implements the System.Collections.IEnumerator interface.

This method inherits from the System.Collections.IEnumerator.Reset method.

Examples

These examples show two ways to enumerate the CustomStrokes collection in order to retrieve each Strokes object contained in the collection.

This example obtains the IEnumerator for the CustomStrokes collection, and uses it to traverse the collection. Each Strokes object is then scaled by a factor of 2.

Private Sub EnumerateCustomStrokesWithEnumerator(ByVal mInk As Ink)
    Dim mCustomStrokesEnumerator As IEnumerator = mInk.CustomStrokes.GetEnumerator()
    mCustomStrokesEnumerator.Reset()
    While (mCustomStrokesEnumerator.MoveNext())
        Dim S As Strokes = DirectCast(mCustomStrokesEnumerator.Current, Strokes)
        S.Scale(2, 2)
    End While 
End Sub
private void EnumerateCustomStrokesWithEnumerator(Ink mInk)
{
    IEnumerator mCustomStrokesEnumerator = mInk.CustomStrokes.GetEnumerator();
    mCustomStrokesEnumerator.Reset();
    while (mCustomStrokesEnumerator.MoveNext())
    {
        Strokes S = (Strokes)mCustomStrokesEnumerator.Current;
        S.Scale(2, 2);
    }
}

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

Private Sub EnumerateCustomStrokesWithForEach(ByVal mInk As Ink)
    For Each S As Strokes In mInk.CustomStrokes
        S.Scale(2, 2)
    Next 
End Sub
private void EnumerateCustomStrokesWithForEach(Ink mInk)
{
    foreach (Strokes S in mInk.CustomStrokes)
    {
        S.Scale(2, 2);
    }

}

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

CustomStrokes.CustomStrokesEnumerator Class

CustomStrokes.CustomStrokesEnumerator Members

Microsoft.Ink Namespace

CustomStrokes