3

Generic is your call, as using generic would avoid casting objects. Would this version work with you ? : internal class EventManager<T> { private readonly Dictionary<int, Action<T>> events = new Dictionary<int, Action<T>>(); public virtual void Subscribe(int incidentId, Action<T> action) { if (...


3

I don't see any glaring issues with the generic EventManager. Yes Dictionary of Dictionary does happen and is sometimes needed. One thing to consider is this implementation violates the Liskov substitution principle of SOLID. Usually in a non generic version the code would take the object and do "as" their type and check if not null. While the that ...


2

Do you necessarily want to have one Event-Manager only ? If you would have EventManager<t>, instead of 3 generic methods, you would have one Eventmanager by Type. It's already resolved at compile time, which dictionary to access. Today, Trigger<int> and Trigger<string> put their things in the same dictionary, which you need to subdivide ...


2

It's good to have single method to control flow as you have in B, but this method should be mostly calling other methods of your class (you also call there checkQuantity for example, which is also in A). That way add is still very flexible - you can override those methods (probably protected methods, not public), that it calls or as last resort override that ...


1

I see what you are trying to achieve, while your question does not fully meet the Code Review rules, but I guess some inputs won't hurt specially in my free time ;). In my opinion, You should use DateTime instead of string and int. You should combine Talk and Slot, as it should be only one class that hold the meeting details (subject, time, and place .....


Only top voted, non community-wiki answers of a minimum length are eligible