Lecture overview -- Keyboard shortcut: 'u'  Previous page: Sample use of IComparable -- Keyboard shortcut: 'p'  Next page: Sample use of IFormattable -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Help page about these notes  Alphabetic index  Course home  Page 16 : 37
Object-oriented Programming in C#
Abstract classes, Interfaces, and Patterns
Sample use of IEnumerator and IEnumerable

The interface IEnumerator in System.Collections is used as the basis for iteration with foreach

/user/normark/oop-csharp-1/sources/c-sharp/interfaces/reproductions/IEnumerable.csA reproduction of the interface IEnumerable.

/user/normark/oop-csharp-1/sources/c-sharp/interfaces/reproductions/IEnumerator.csA reproduction of the interface IEnumerator.

/user/normark/oop-csharp-1/sources/c-sharp/interval/for-illustration-of-iterator/Interval.csIEnumerator in the type Interval.

/user/normark/oop-csharp-1/sources/c-sharp/interval/for-illustration-of-iterator/app_1.csIteration with and without foreach based on the enumerator.


The interface IEnumerable prescribes an operation GetEnumerator that returns an enumerator of type IEnumerator