private void AddNewStudent(Student newStudent) { foreach (Student student in this.students) { if (newStudent.ClassNumber == student.ClassNumber) { throw new InvalidOperationException("There's already a student with this class number in the class!"); } } this.students.Add(newStudent); }
public void RemoveStudent(Student student) { this.students.Remove(student); }
public void AddStudent(Student newStudent) { AddNewStudent(newStudent); }