Handle Generic methods in a dictionary according to type
问题 I have a generic method public delegate void Handler<T>(T val); I enable users to register to events and provide this delegate. I need to save the list of delegate according to their types. I tried saving in a dictionary of Type and object. when adding the method I cast it to a List<Handler<T>> according to the T. but then when an event occurred I do not have the T so cannot cast to the relevant list of generic handlers (I do have the Type but not the T) I solved this by saving methodInfo