/// <summary> /// attaches this event-handler to the event on object obj. /// </summary> /// <param name="obj"></param> public virtual void AttachToEventOn(object obj) { try { // attach the handler to the event on object obj Info.AddEventHandler(obj, EventHandlerDelegate); // add to the list of subscribers: _subscribers.Add(obj); } catch (Exception ex1) { Console.WriteLine("Could Not Bind to Event: " + Info.Name + " on: " + obj.ToString()); } }
/// <summary> /// Adds a handler to the event. /// </summary> public void Add(Delegate handler) => Info.AddEventHandler(Instance, handler);