static void Main() { List<int> list = new List<int>(); list.Add(1); list.Add(5); list.Add(9); List<int>.Enumerator e = list.GetEnumerator(); Write(e); } static void Write(IEnumerator<int> e) { while (e.MoveNext()) { int value = e.Current; Console.WriteLine(value); } }
时间: 2024-10-15 09:39:09