public void AddCourse(Course course) { if (course == null) { throw new ArgumentNullException("course", "Adding course requires course object as argument"); } if (course.GetType() != typeof (Course)) { throw new ArgumentException("You cannot add non course objects to courses"); } if (this.courses.Contains(course)) { throw new InvalidOperationException("Such course already exists."); } this.courses.Add(course); }