예제 #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("***Iterator Pattern Demo***");
            ISubject Sc_subject  = new Science();
            ISubject Ar_subjects = new Arts();

            IIterator Sc_iterator = Sc_subject.CreateIterator();
            IIterator Ar_iterator = Ar_subjects.CreateIterator();

            Console.WriteLine("Science subjects");
            Print(Sc_iterator);
            Console.WriteLine("Art subjects");
            Print(Ar_iterator);

            Console.ReadLine();
        }
예제 #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("***Iterator Pattern Demo***");
            ISubjects ScienceSubjects = new Science();
            ISubjects ArtsSubjects    = new Arts();

            IIterator IteratorForScience = ScienceSubjects.CreateIterator();
            IIterator IteratorForArts    = ArtsSubjects.CreateIterator();

            Console.WriteLine("\nScience subjects :");
            Print(IteratorForScience);

            Console.WriteLine("\nArts subjects :");
            Print(IteratorForArts);

            Console.ReadLine();
        }
예제 #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("***Iterator Pattern Demonstration.***");
            //For Science
            ISubjects subjects = new Science();
            IIterator iterator = subjects.CreateIterator();

            Console.WriteLine("\nScience subjects :");
            Print(iterator);

            //For Arts
            subjects = new Arts();
            iterator = subjects.CreateIterator();
            Console.WriteLine("\nArts subjects :");
            Print(iterator);

            Console.ReadLine();
        }