First, use a modified code to demonstrate the usage. It can only be used. [Csharp/** Created by SharpDevelop. * User: Owner * Date: 2012-12-14 * Time: 13:43 ** To change this template use Tools | Options | Coding | Edit Standard Headers. */using System; using System. collections; /// <summary> // IEnumerable and IEnumrator are combined to implement foreach. /// </Summary> namespace TestIEnumeratorAndIEnumratable {// <summary> // individual class: this class stores the information of a single individual and a method // </summary> public class individual {public string Information 1; public string Information 2; public individual (string Information 1, string Information 2) {this. information 1 = Information 1; this. information 2 = Information 2;} public void () {Console. writeLine (this. information 1 + "=" + this. information 2); }}/// <summary> // collection class: inherits from the IEnumerable interface and provides the possibility of foreach. /// </Summary> public class: IEnumerable {// <summary> // The Group is a one-vote individual. // </summary> private individual [] one-vote individual; /// <summary> /// this group is composed of an initial group of individuals for convenience. /// </Summary> /// <param name = "pArray"> </param> public group (individual [] pArray) {one-vote individual = new individual [pArray. length]; for (int I = 0; I <pArray. length; I ++) one-vote individual [I] = pArray [I] ;}/// <summary> // interface implementation function of IEnumerable, get the iterator used by foreach /// </summary> /// <returns> </returns> public IEnumerator GetEnumerator () {return new individual pointer (one-vote individual); }}/// <summary> // individual pointer: The iterator for the individual class inherited from IEnumerator. /// Provides Function Support for the iterator. /// </Summary> public class individual pointer: IEnumerator {// <summary> /// pointer of one-vote individual /// </summary> public individual [] pointer of one-vote individual; /// <summary> /// indicator mark of the iterator's current position /// </summary> int position =-1; /// <summary> /// value assignment of the individual pointer: point to a bunch of unmanaged individuals // </summary> /// <param name = "list"> </param> public individual pointers (individual [] list) {pointer = list ;}//< summary> /// the implementation function of the IEnumerator interface. The iterator moves down. Foreach is used. We do not call it. /// </Summary> /// <returns> </returns> public bool MoveNext () {position ++; return (position <pointer of a single ticket. length) ;}/// <summary> /// interface implementation function of IEnumerator. The iterator is reset. Foreach is used. We do not call it. /// </Summary> public void Reset () {location =-1 ;}/// <summary> // the implementation function of IEnumerator to obtain the current value. Foreach is used. We do not call it. /// </Summary> public object Current {get {try {return pointer [position];} catch (IndexOutOfRangeException) {throw new InvalidOperationException () ;}}} class Program {public static void Main (string [] args) {Individual [] Individual set = new individual [3] {new individual ("1", "One"), new individual ("2", "Two "), new individual ("3", "Three")}; collective list = new collective (individual set); foreach (individual p in list) p. report (); Console. readKey () ;}} the above example clearly demonstrates IEnumerat Or (iterator Interface) and IEnumerable (traversal Interface) usage. It generally represents everything. I want to use the concepts of individuals and groups to better understand this function. As I understand, the independent IEnumerator interface is useless. The IEnumerable interface can work with various classes (ArrayList, Queue, and so on) inherited from IEnumerator provided by the system, without implementation every time.