Пример #1
0
 public bool MoveNext()
 {
     //Avoids going beyond the end of the collection.
     if (++curIndex >= _collection.Count)
     {
         return(false);
     }
     else
     {
         // Set current box to next item in collection.
         curExam = (IDateAndCopy)_collection[curIndex];
     }
     return(true);
 }
Пример #2
0
        // Реализацию интерфейса IDateAndCopy:

        object IDateAndCopy.DeepCopy()
        {
            //Student copy = new Student(this.StudentInfo, this.EducationType, this.GroupNo);  // (старая версия)
            Student copy = new Student(this.FirstName, this.LastName, this.DateOfBirth, this.EducationType, this.GroupNo);

            // (старая версия)
            //copy.ExamInfo = new Exam[this.ExamInfo.Length];
            //for (int i = 0; i < this.ExamInfo.Length; i++)
            //{
            //    IDateAndCopy exam = this.ExamInfo[i];
            //    copy.ExamInfo[i] = (Exam)exam.DeepCopy();
            //}

            for (int i = 0; i < this.ExamInfo.Count; i++)
            {
                IDateAndCopy exam = (Exam)this.ExamInfo[i];
                copy.ExamInfo[i] = (Exam)exam.DeepCopy();
            }

            return(copy);
        }
Пример #3
0
 public StudentEnumerator(ArrayList collection)
 {
     _collection = collection;
     curIndex    = -1;
     curExam     = default(IDateAndCopy);
 }