Error!
Success!

Do you know how you can unsubscribe from anonymous method?

0
kicks

Do you know how you can unsubscribe from anonymous method?  (Unpublished)

Anonymous Methods is a useful feature which we receive in Framework 2.0. It allows to easy pass a small code block as a delegate parameter (you can set a large block code but this code will be harmful because it is complex and isn't clear for perception). For example: button1.Click += delegate { MessageBox.Show( "Anonymous" ); }; But I have one trouble. What can I do if I want to unsubscribe from event. Seems it is subscribed finally, isn't it?.. Noup! If we declare instance of delegate before define we can unsubscribe a event from this delegate in the code block. For example:


Kicked By:
Drop Kicked By: