示例#1
0
        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();
            }
        }
示例#2
0
 public ConcreteIterator(ConcreteAggregate aggregate)
 {
     _aggregate = aggregate;
 }