Returns a reference to an IEnumerator interface, whose purpose is to grant access to an enumeration's items.
Public Function GetEnumerator() As IEnumerator
When GetEnumerator is called, it constructs an enumerator object containing the current version number in the collection and a reference to the collection's items. Every time the enumerator is accessed, it compares the version of the enumerator with the version of the collection. If the versions do not match, it means that the collection has changed; an exception then occurs.
The following example shows how to use GetEnumerator to retrieve a member of an enumeration.
Imports System.Collections Public Class TestClass : Implements IEnumerable Public Function GetEnumerator() As IEnumerator Implements _ IEnumerable.GetEnumerator Return CType(Me, IEnumerator) End Function
Namespace: Microsoft.VisualBasic
Module: Collection
Assembly: Microsoft Visual Basic .NET Runtime (in Microsoft.VisualBasic.dll)