How to get GetEvents instead of GetFields?
var t = something.GetType(); var eventInfos = t.GetEvents(); foreach (var info in eventInfos) { if (info.EventHandlerType == TypeOf(CustomEventHandler<this.fieldInfo.Name>) info.AddEventHandler(...); }
I'm not quite sure about the type comparison, but again, fieldInfo.Name cannot be used in this way.
Henk holterman
source share