Enumerates an array using an enumerator object
using System;
using System.Collections;
public class Starter {
public static void Main() {
int[] numbers = { 1, 2, 3, 4, 5 };
IEnumerator e = numbers.GetEnumerator();
while (e.MoveNext()) {
Console.WriteLine(e.Current);
}
}
}
Related examples in the same category