慕桂英3389331
int[] ary = new int[] { 1, 2, 3, 4, 5 };System.Collections.IEnumerator ieach = ary.GetEnumerator();for (int i = 0; ieach.MoveNext(); i++) {Console.WriteLine(string.Format("index:{0} value:{1}", i, ieach.Current));}所有支持foreach的结构都必须实现System.Collections.IEnumerator,也就是说都有GetEnumerator()方法