public delegate void CustomEventHandler(object sender, EventArgs e);
public event CustomEventHandler CustomEvent;
protected virtual void OnCustomEvent(EventArgs e)
{
CustomEventHandler handler = CustomEvent;
if (handler != null)
{
handler(this, e);
}
}
instance.CustomEvent += HandleCustomEvent;
private void HandleCustomEvent(object sender, EventArgs e)
{
// 处理事件
}