private void Add_NeeStudent(Object sender, StudentEventArgs e) { if (e.student != null) { students++; list.Add(e.student); } }
//注册到学校的花名册,同时发布事件 public void ProcessRegister() { Student s; for (int i = 0; i < list.Count; i++ ) { s = (Student)list[i]; //创建事件参数 StudentEventArgs e = new StudentEventArgs(s); if (onNewStudent != null && s != null) { onNewStudent(this, e);//触发事件,并发送学生信息 } } }
//注册到学校的花名册,同时发布事件 public void ProcessRegister() { Student s; for (int i = 0; i < list.Count; i++) { s = (Student)list[i]; //创建事件参数 StudentEventArgs e = new StudentEventArgs(s); if (onNewStudent != null && s != null) { onNewStudent(this, e);//触发事件,并发送学生信息 } } }