I was wondering if there is a way to remove all functions added to a Button.Clicked().
For example I have this button:
Button btn = new Button();
btn.Clicked+=function_1;
btn.Clicked+=function_2;
btn.Clicked+=function_3;
void function_1(object sender,System.EventArgs e){
//...
//Same for function_2 and function_3
}
I need to remove all these functionalities from the button. I already know that I can do this:
btn.Clicked-=function_1;
btn.Clicked-=function_2;
btn.Clicked-=function_3;
But I am looking for a abstract way to do it. For example something like this (pseudocode):
foreach (f in btn.ClickedFuncions){
btn.Clicked-=f;
}
Is it posible? How can I do it?