Chapter 8. Enumerators
Arrays and collections were introduced in Chapter 5—both of these are collection types. Collections group related types, even if the types are related only through inheritance from System.Object. You could maintain a dynamic array of Employee types, which would include instances of HourlyEmployee, ExemptEmployee, and CommissionedEmployee types. You could have a queue of bank requests, such as DepositTransaction, WithdrawalTransaction, and InterestTransaction objects. The relationship of these classes is defined by inheritance at compile time, which allows polymorphism at run time. Enumerating such collections of related objects is a frequent and valuable behavior in many applications.
Enumeration is the process of iterating ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access