public void AddStudent(Student student) { if (this.students.Any(currentStudent => currentStudent.Id == student.Id)) { throw new InvalidOperationException("Duplicated Id!"); } this.students.Add(student); }
public void AddStudent(Student student) { if (!(this.students.Count < Course.Capacity)) { throw new InvalidOperationException("Course is full!"); } if (this.students.Contains(student)) { throw new ArgumentException("Student already added!"); } this.students.Add(student); }
public bool RemoveStudent(Student student) { return this.students.Remove(student); }