C# 2.0 Iterators

by mosessaur| 11 October 2006| 0 Comments
What is Iterators:
Iterators provide a simpler way to create classes that can be used with the foreach statement without implementing the IEnumerable and IEnumerator interfaces.
Introduction:
Iterators are a new feature in C# 2.0. An iterator is a method, get accessor or operator that enables you to support foreach iteration in a class or struct without having to implement the entire IEnumerable interface. Instead, you provide just an iterator, which simply traverses the data structures in your class. When the compiler detects your iterator, it will automatically generate the Current, MoveNext and Dispose methods of the IEnumerable or IEnumerator interface.

Read the full article @ DotNetSlackers.com
Comments are closed