private void Save_Click(object sender, EventArgs e) { DateTime dob = DateTime.Parse(DoB.Text); Student s = new Student(FirstName.Text, LastName.Text, dob); foreach (CourseBoxItem cbi in RegisteredCourses.Items) { cbi.Value.registerStudent(s); } StudentCreated?.Invoke(this, s); }
//formatting/syntax might be off here /// <summary> /// Trigger method called to raise the <see cref="NewStudentCreated"/> event /// </summary> protected virtual void OnStudentCreated(StudentDTO studentDTO) { //null test, without making a copy while keeping thread-safety StudentCreatedEventArgs args = new StudentCreatedEventArgs() { Student = studentDTO }; StudentCreated?.Invoke(this, args); }