How to Use the Iterator Pattern in C# the iterator pattern provides a process to obtain the aggregator object without knowing its implementation. Use Case Let us take an example of a collection list of cars and string[] an array of motorcycles; we need to design an aggregator object to iterate over the collection without knowing whether it's a list or an array. The iterator design pattern helps solve this problem wherein a standard iterator will traverse different collection types. Prerequisites Basic knowledge of OOPs concepts. Any programming language knowledge. The article demonstrates the usage of iterator design patterns using the C# programming language. Getting Started Considering the above use case, let us define a custom iterator interface that acts as an abstract layer over the list and array iterator. public interface IVehicleIterator { void First ( ) ; bool IsDone ( ) ; string Next ( ) ; string Current ( ) ; } Now write car and motorcycl