public void TestCase1()
        {
            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);
            item = iterator.MoveNext();
              }
        }
示例#2
0
        public void TestCase1()
        {
            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);
                item = iterator.MoveNext();
            }
        }