I have a button control, and I’d need to remove all the event handlers attached to its Click event.
How would that be possible?
Button button = GetButton();
button.Click.RemoveAllEventHandlers();
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can’t, basically – at least not without reflection and a lot of grubbiness.
Events are strictly “subscribe, unsubscribe” – you can’t unsubscribe someone else’s handler, any more than you can change someone else’s reference to an object.