IEnumerator: Reset

Reset

Requests the enumerator resets itself to begin enumerating from the beginning.



 Public Sub Reset ( )

Examples

The following example shows an implementation of the IEnumerator interface.

This example is part of a larger complete example for IEnumerable.

Option Explicit
Implements IEnumerator

Private mBase As EnumeratorBase
Private mContainer As Container


'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   Constructors
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Sub Init(ByVal Container As Container)
    Set mBase = NewEnumeratorBase(0, Container.Count)
    Set mContainer = Container
End Sub


'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   IEnumerator
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Property Get IEnumerator_Current() As Variant
    MoveVariant IEnumerator_Current, mContainer.Item(mBase.Index)
End Property

Private Function IEnumerator_MoveNext() As Boolean
    IEnumerator_MoveNext = mBase.MoveNext
End Function

Private Sub IEnumerator_Reset()
    mBase.Reset
End Sub

See Also

Project CorLib Overview

Class IEnumerator Overview