/// <summary> /// Searches the subscriber for event handlers it implements, and removes any that can be found. /// </summary> /// <param name="subscriber">The subscriber to remove the event handlers of.</param> /// <returns><c>true</c> if at least one event handler was removed; <c>false</c> if none could be found.</returns> public bool RemoveAll(object subscriber) { if (subscriber.NullReference()) { throw Exc.Null(nameof(subscriber)); } var subscriberTypeInfo = EventSubscriberTypeInfo.AddOrGet(subscriber.GetType()); return(subscriberTypeInfo.RemoveAll(this, subscriber)); }
/// <summary> /// Searches the subscriber for event handlers it implements, /// and adds those that were not yet registered. /// </summary> /// <param name="subscriber">The subscriber to add the event handlers of.</param> /// <param name="weakRef"><c>true</c> to store weak references; <c>false</c> to store strong references.</param> /// <returns><c>true</c> if at least one event handler was added; otherwise, <c>false</c>.</returns> public bool AddAll(object subscriber, bool weakRef = true) { if (subscriber.NullReference()) { throw Exc.Null(nameof(subscriber)); } var subscriberTypeInfo = EventSubscriberTypeInfo.AddOrGet(subscriber.GetType()); return(subscriberTypeInfo.AddAll(this, subscriber, weakRef)); }