public void Run() { var aggregate = new ConcreteAggregate(); aggregate[0] = "Apple"; aggregate[1] = "Orange"; aggregate[2] = "Strawberry"; var iterator = new ConcreteIterator(aggregate); object item = iterator.First(); while (!iterator.IsDone()) { Console.WriteLine(item.ToString()); item = iterator.MoveNext(); } }
public ConcreteIterator(ConcreteAggregate aggregate) { _aggregate = aggregate; }