IEnumerator is used for iteration.IEnumerator can use GetEnumerator() method to get the values from arraylist and display the values using MoveNext or current method.
Example:
we can create the array list in vb.net using
Dim list as new arraylist
and add the elements in to arraylist using Add like
ab.Add(“First”)
and use IEnumerator and get the values from array list using GetEnumerator method.
Dim en as IEnumerator = ab.GetEnumerator() and move to the next element in the list by using MoveNext method.
en.MoveNext
We can get the current elements by using Current method.
en.Current)
Advertisement