public void Debug(string info) { DemoEventArgs eventArgs = new DemoEventArgs(info); if (DebugEvent != null) { DebugEvent(this, eventArgs); } }
//步骤5,定义事件处理方法 void MyEvent(object sender, DemoEventArgs e) { Console.WriteLine(id + " received this message: {0}", e.Message); }