Click here to Skip to main content
15,888,803 members
Articles / Programming Languages / C#

Clear All Events Listeners of an Instance or Static Event

Rate me:
Please Sign up or sign in to vote.
5.00/5 (9 votes)
29 Sep 2021MIT 7.3K   7  
How to clear all events is quite simple. It needs a finger of reflection...
This snippet will help you if you need to cleanup events. In a normal way, you have to use += or -=, or use WeakEventHandler().AddHandler or RemoveHandler. But sometimes, you could need a harder way!

Views

Daily Counts

License

This article, along with any associated source code and files, is licensed under The MIT License


Written By
Web Developer
France France
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions