Esempio n. 1
0
        static void Main(string[] args)
        {
            Clazz clazz = new Clazz();

            clazz.AddStudent(new Student("张三"));
            clazz.AddStudent(new Student("李四"));
            clazz.AddStudent(new Student("王五"));

            Iterator iterator = (clazz as Aggregate).CreateInterator();

            while (!iterator.Done)
            {
                object current = iterator.Current();
                Console.WriteLine(current);
                iterator.Next();
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 对班级的依赖
 /// </summary>
 /// <param name="classToInterator"></param>
 public ClazzASCIterator(Clazz classToInterator)
 {
     this.myclass = classToInterator;
 }
Esempio n. 3
0
 /// <summary>
 /// 对班级的依赖
 /// </summary>
 /// <param name="classToInterator"></param>
 public ClazzDESCIterator(Clazz classToInterator)
 {
     this.myclass      = classToInterator;
     this.currentIndex = this.myclass.StudentsCount - 1;
 }