12. Collections

THE MOST PREVALENT USE of generics in any language is in the area of collections. Collections deal with sets of like objects and with managing those objects as a group. This chapter looks at the collection classes provided with the runtime and how you use them within your applications. It also covers the various collection interfaces and how they relate to each other, and it includes a discussion of how to create custom collections using iterators. This C# 2.0 feature simplifies implementation of how the foreach statement iterates over the elements in a collection. Iterators not only encapsulate the internal data structure of your collection classes, but they also improve control over end-user access and the use of data within ...

Get Essential C# 2.0 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.