O'Reilly logo

Microsoft® Visual C#® 2005 Step by Step by John Sharp

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 18. Enumerating Collections

After completing this chapter, you will be able to:

  • Manually define an enumerator that can be used to iterate over the elements in a collection.

  • Implement an enumerator automatically by creating an iterator.

  • Provide additional iterators that can step through the elements of a collection in different sequences.

In Chapter 10, you learned about arrays and collection classes for holding sequences or sets of data. Chapter 10 also introduced the foreach statement which you can use for stepping through, or iterating over, the elements in a collection. At the time, you just used the foreach statement as a quick and convenient way of accessing the contents of a collection, but now it is time to learn a little more about ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required