// This is how you "publish" and event. All it entails is looking up // the event type and calling the delegate containing all the handlers public void Fire(EventE e) { Type type = e.GetType(); EventE.Handler handlers; if (registeredHandlers.TryGetValue(type, out handlers)) { handlers(e); } }
public void Fire(EventE e) { EventDelegate del; if (delegates.TryGetValue(e.GetType(), out del)) { del.Invoke(e); } }