private static void Main(string[] args)
        {
            //SequenceAggregate list = new SequenceAggregate();
            ReverseAggregate list = new ReverseAggregate();

            list[0] = "张三";
            list[1] = "李四";
            list[2] = "王五";
            list[3] = "赵六";
            list[4] = "周七";

            IIterator i    = list.GetIterator();
            object    item = i.First();

            Console.WriteLine("First:" + item);

            while (i.Current() != i.Last())
            {
                Console.WriteLine(i.Current());
                i.Next();
            }

            Console.WriteLine("Last:" + i.Last());

            Console.ReadLine();
        }
        private static void Main(string[] args)
        {
            //SequenceAggregate list = new SequenceAggregate();
            ReverseAggregate list = new ReverseAggregate();
            list[0] = "张三";
            list[1] = "李四";
            list[2] = "王五";
            list[3] = "赵六";
            list[4] = "周七";

            IIterator i = list.GetIterator();
            object item = i.First();
            Console.WriteLine("First:" + item);

            while (i.Current() != i.Last())
            {
                Console.WriteLine(i.Current());
                i.Next();
            }

            Console.WriteLine("Last:" + i.Last());

            Console.ReadLine();
        }
 public ReverseIterator(ReverseAggregate aggregate)
 {
     _aggregate = aggregate;
     current = _aggregate.Count - 1;
 }
示例#4
0
 public ReverseIterator(ReverseAggregate aggregate)
 {
     _aggregate = aggregate;
     current    = _aggregate.Count - 1;
 }