Beispiel #1
0
        static void Main(string[] args)
        {
            Clazz clazz = new Clazz();

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

            System.Collections.IEnumerator enumerator = (clazz as System.Collections.IEnumerable).GetEnumerator();
            while (enumerator.MoveNext())
            {
                object current = enumerator.Current;
                Console.WriteLine(current);
            }

            foreach (var item in clazz)
            {
                Console.WriteLine(item);
            }
        }
Beispiel #2
0
 /// <summary>
 /// 对班级的依赖
 /// </summary>
 /// <param name="classToInterator"></param>
 public ClazzASCIterator(Clazz classToInterator)
 {
     this.myclass = classToInterator;
 }