IEnumerator

IEnumerator


This interface is used to allow for custom enumerators to be built.


Remarks

The enumerator can be used manually to enumerate through the values of a list, or it can be wrapped in a custom enumerator to allow it to be used in the For..Each context.

To use an IEnumerator object in For..Each, call the CreateEnumerator method passing in the IEnumerator object. The returned value is then returned in the standard NewEnum(-4) function called by For..Each. The enumeration will then be delegated to the custom IEnumerator object.

Example

 Public Function NewEnum() As IUnknown
     Dim e As New MyEnumerator
     e.Init Me
     Set NewEnum = CreateEnumerator(e)
 End Function

See Also

Project VBCorLib Overview

Public:

Properties:

NameDescription
 Current (get)This returns the current item of the enumeration. The current item is called after a successful MoveNext. 

Methods:

NameDescription
 MoveNextRequests the enumerator moves to the next item being enumerated. Returns True on success, False otherwise. This is called prior to Current. If this is successful, Current will be called. 
 ResetRequests the enumerator resets itself to begin enumerating from the beginning.