public void RemoveStudent(Student student) { if (student == null) { throw new ArgumentNullException("teacher"); } _students.Remove(student); }
static void Main() { // we could use named arguments here for clarity, // but in the pre-C#4.0 era they were not available yet. Student student1 = new Student ( "Billy", "Jackson", new DateTime(1990, 12, 12), "5th Avenue", String.Empty, "Dodge City", "Kansas", "67801", "U.S.A." ); student1.PushGrade( new NumericGrade(90.0) ); student1.PushGrade( new NumericGrade(70.0) ); student1.PushGrade( new NumericGrade(95.0) ); student1.PushGrade( new NumericGrade(65.0) ); student1.PushGrade( new NumericGrade(80.0) ); Student student2 = new Student ( "Eric", "Kruger", new DateTime(1992, 4, 16), "Mastodon Avenue, Seattle, Washington", String.Empty, "Seattle", "Washington", "98113", "U.S.A." ); student2.PushGrade( new NumericGrade(90.0) ); student2.PushGrade( new NumericGrade(90.0) ); student2.PushGrade( new NumericGrade(95.0) ); student2.PushGrade( new NumericGrade(85.0) ); student2.PushGrade( new NumericGrade(100.0) ); Student student3 = new Student ( "Jeremy", "Pokluda", new DateTime(1991, 1, 24), "Jamestown Boulevard, Jackson, Minnesota", String.Empty, "Jackson", "Minnesota", "55003", "U.S.A." ); student3.PushGrade( new NumericGrade(100.0) ); student3.PushGrade( new NumericGrade(100.0) ); student3.PushGrade( new NumericGrade(95.0) ); student3.PushGrade( new NumericGrade(65.0) ); student3.PushGrade( new NumericGrade(90.0) ); Course csCourse = new Course ( "Programming with C#", 20, 4 ); csCourse.AddStudent(student1); csCourse.AddStudent(student2); csCourse.AddStudent(student3); csCourse.ListStudents(); }
public void AddStudent(Student student) { if (student == null) { throw new ArgumentNullException("student"); } _students.Add(student); }