List<int> list = new List<int>(); for (int i = 1; i <= 10; i++) list.Add(i); IEnumerable<int> enumer = list; foreach (int item in enumer) { textBox1.Text += item.ToString() + "|"; } IEnumerator<int> enumer2 = list.GetEnumerator(); while (enumer2.MoveNext()) { textBox2.Text += enumer2.Current.ToString() + "|"; } IEnumerator<int> enumer3 = list.GetEnumerator(); foreach (int item in enumer3) // Try use foreach,but compilation errors in here. { textBox3.Text += item.ToString() + "|"; }