using System; class Class1
{ static void Main(string[] args) { Student s1=new Student(); Student s2=new Student(); s1.RegisterOK +=new Student.DelegateRegisterOkEvent(Student_RegisterOK); s2.RegisterOK +=new Student.DelegateRegisterOkEvent(Student_RegisterOK); s1.Register(); s2.Register(); Console.ReadLine(); } static void Student_RegisterOK() { Console.WriteLine("Hello"); } } class Student { public delegate void DelegateRegisterOkEvent(); public event DelegateRegisterOkEvent RegisterOK; |