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.
Public Sub GetEnumerator() As IEnumerator Implements IEnumerable.GetEnumerator GetEnumerator = MyCollection.GetEnumerator End Function