Example #1
0
        public static void Run()
        {
            Country country = new Country();

            /// the get_Cities property has been removed.
            /// Client has to use Iterator.
            for (IIterator it = country.CreateIterator() ; !it.IsDone ; it.Next())
            {
                Console.Write(it.CurrentItem as string + ", ");
            }

            /// This demonstrates the abililty to create many iterators
            /// and to iterate on them simultaniously
            IIterator it1 = country.CreateIterator();
            IIterator it2 = country.CreateIterator();

            it1.Next();
            it1.Next();
            Console.WriteLine(it1.CurrentItem + Environment.NewLine);

            Console.WriteLine("Two simultaneous iterations:");
            while (it1.Next() && it2.Next())
            {
                Console.Write("[" + it1.CurrentItem + "]" + " " + it2.CurrentItem + " ");
            }
        }