public static long AddEventHandler(T instance, string eventMemberName, Delegate handler) { instance.AssertNotNull(nameof(instance)); eventMemberName.AssertNotBlank(nameof(eventMemberName)); handler.AssertNotNull(nameof(handler)); var key = DateTime.UtcNow.Ticks; var eventMember = Events[eventMemberName]; var reference = new HandlerReference(new WeakReference <T>(instance), eventMember, handler); eventMember.Add(instance !, handler); EventHandlers.Add(key, reference); return(key); }