Call delegate list helper class for removing unknown events of a specified object Using Reflection

Source: Internet
Author: User

                                                   BindingFlags _SEARCH_BINDINGFLAGS = BindingFlags.Instance |                                                                    BindingFlags.Static |                                                                    BindingFlags.Public |                                                               ClearEventHandler( targetObj,              Type targetType =             EventInfo eventInfo =              (eventInfo == )   ArgumentException(             Delegate[] eventInvocationList =              (Delegate handler                                                                 Delegate[] GetEventInvocationList( targetObj,              FieldInfo eventFieldInfo = GetEventField(targetObj.GetType(), eventName,               (eventFieldInfo !=                   eventFieldValue =                  (eventFieldValue                                       }                      PropertyInfo propertyInfo = targetObj.GetType().GetProperty(                      (propertyInfo !=                          EventHandlerList eventHandlerList = propertyInfo.GetValue(targetObj, )                           (eventHandlerList !=                              Delegate eventHanlder =                              (eventHanlder !=                                                                                                                                      FieldInfo GetEventField(Type target,  eventName,              FieldInfo eventInfo =              (inherited && eventInfo ==                   (target.BaseType !=                       (target.BaseType ==                          eventInfo = GetEventField(target.BaseType,  + eventName,                                               eventInfo = GetEventField(target.BaseType, eventName,                                                                                        EventInfo GetEvent(Type target,                 }

PS: This Demo has many shortcomings and is for reference only. Please advise me to help the younger brother improve and improve it.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.