예제 #1
0
 public void AddStudent(Student student)
 {
     if (this.Students.Count < MaxStudentCount)
     {
         this.students.Add(student);
     }
     else
     {
         Console.WriteLine("Course is full!");
     }
 }
예제 #2
0
        public void AddStudent(Student student)
        {
            var studentWithSameUNIsEnlisted = this.uniqueStudentNumbers.IndexOf(student.UniqueNumber);
            if (studentWithSameUNIsEnlisted >= 0)
            {
                Console.WriteLine("Student with unique number: {0} is already enlisted in this school!", student.UniqueNumber);
                return;
            }

            this.students.Add(student);
            this.uniqueStudentNumbers.Add(student.UniqueNumber);
        }
예제 #3
0
 public void RemoveStudent(Student student)
 {
     var studentIndexInCourse = this.students.IndexOf(student);
     if (studentIndexInCourse >= 0)
     {
         this.students.Remove(student);
         Console.WriteLine("Student removed succesfully!");
     }
     else
     {
         Console.WriteLine("Student was not found in this course!");
     }
 }