Ejemplo n.º 1
0
        //LD_ITERATOR_000
        public static void RunIteratorBehavioralPattern()
        {
            //LDITE001
            IAggregate <string> aggregate = new ConcreteAggregate <string>();

            aggregate.AddItem("Apple");    //add sample data
            aggregate.AddItem("Orange");
            aggregate.AddItem("Banana");
            aggregate.AddItem("Plum");

            //iterate through the collection using IAggregate only
            foreach (string i in aggregate.GetAll())
            {
                Console.WriteLine(i);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Entry point into console application.
        /// </summary>
        static void Main()
        {
            IAggregate <string> aggregate = new ConcreteAggregate <string>();

            aggregate.AddItem("Apple");    //add sample data
            aggregate.AddItem("Orange");
            aggregate.AddItem("Banana");
            aggregate.AddItem("Plum");

            //iterate through the collection using IAggregate only
            foreach (string i in aggregate.GetAll())
            {
                Console.WriteLine(i);
            }
            // Wait for user
            Console.ReadKey();
        }