IEnumerable has just one member, a method called GetEnumerator which returns an IEnumerator.
IEnumerator has two methods, MoveNext (which returns a bool) and Reset (void), and one property, Current, of type object.
Consequently, if a collection type implements IEnumerable then there must be an IEnumerator available to iterate over the collection. You can then use the members of the IEnumerator to perform the actual enumeration. In the case of the foreach statement all this is done for you behind the scenes.
VulpesPosted May 14, 2012, 2:33 PM