Previous Page
Next Page

Chapter 18
Enumerating Collections
After completing this chapter, you will be able to:

In Chapter 10, “Using Arrays and Collections,” 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 how this statement actually works. This topic becomes important when you start defining your own collection classes, especially since Iterators have been added to C# 2.0 to help you automate much of the process.


Previous Page
Next Page