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);
 }
Exemple #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);
        }
 public StudentEnumerator(ArrayList collection)
 {
     _collection = collection;
     curIndex    = -1;
     curExam     = default(IDateAndCopy);
 }