我不明白为什么在定义事件时我们需要"event"关键字,当我们可以在不使用"event"关键字的情况下执行相同的操作,只需使用委托.
例如
public delegate void CustomEventHandler(int a, string b);
public event CustomEventHandler customEvent;
customEvent += new CustomEventHandler(customEventHandler);
customEvent(1,"a"); // Raising the event
Run Code Online (Sandbox Code Playgroud)
这里,如果我从第二行删除"event"关键字,那么我也可以通过调用委托来引发事件.任何人都可以告诉我为什么需要这个事件关键字?