public void OnNotification(object sender, Notification n) { var notifType = n.GetType(); var baseNotifType = typeof(Notification); while (baseNotifType.IsAssignableFrom(notifType)) { if (_handlers.ContainsKey(notifType)) { _handlers[notifType].DynamicInvoke(sender, n); } notifType = notifType.BaseType; } }