Do you know how you can unsubscribe from anonymous method?(rredcat.blogspot.com)

submitted by RredCatRredCat(299) 2 years, 9 months ago

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:

add a comment |category: |Views: 14

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

No comments so far

information Login or create an account to comment on this story