/// <summary> /// Listen to the event on this object /// </summary> /// <param name="owner">Object to subscribe to</param> /// <param name="replacementSender">Replace sender in the callback with this object if it is not null</param> public void Listen(T owner, object replacementSender = null) { Owners.Add(owner); replacementSenders.Add(replacementSender); if (subscriptions > 0) { @event.AddEventHandler(owner, eventHandler); } }
/// <summary> /// Listen to the event on this object /// </summary> /// <param name="owner">Object to subscribe to</param> public void Listen(T owner) { Assert.Argument(owner, nameof(owner)).NotNull(); Owners.Add(owner); if (_subscriptions > 0) { _event.AddEventHandler(owner, _eventHandler); } }