Exemple #1
0
        static void Main(string[] args)
        {
            ConcretAggregate a = new ConcretAggregate();

            a[0] = "Item A";
            a[1] = "Item B";
            a[2] = "Item C";
            a[3] = "Item D";

            Iterator i = a.CreateIterator();

            Console.WriteLine("Iteragindo com a coleção: ");

            object item = i.First();

            while (item != null)
            {
                Console.WriteLine(item);
                item = i.Next();
            }
        }
Exemple #2
0
        static void Main(string[] args)
        {
            var concretAggregate = new ConcretAggregate();

            concretAggregate[0] = "Item A";
            concretAggregate[1] = "Item B";
            concretAggregate[2] = "Item C";
            concretAggregate[3] = "Item D";

            var iterator = concretAggregate.CreateIterator();

            Console.WriteLine("Interagindo com a coleção:");

            object item = iterator.First();

            while (item != null)
            {
                Console.WriteLine(item);
                item = iterator.Next();
            }
        }
Exemple #3
0
 public ConcretIterator(ConcretAggregate aggregate)
 {
     this._aggregate = aggregate;
 }