public void Do() { if (MyEvent != null) { EventPublisherArgs args = new EventPublisherArgs("데이터"); MyEvent(this, args); } }
public event MyEventHandler MyEvent; //이벤트 정의 public void Do() { //이벤트 가입자가 있는지 확인 if (MyEvent != null) { EventPublisherArgs args = new EventPublisherArgs("데이터"); MyEvent(this, args); //이벤트 발생 } }
static void doAction(object sender, EventPublisherArgs e) { Console.WriteLine("MyEvent 라는 이벤트 발생"); Console.WriteLine("이벤트 매개변수 : " + e.myEventData); }