.NET Event Techniques(devlicio.us)

submitted by BigTunaBigTuna(219) 4 years, 2 months ago

A very simple technique to avoid the need for a null check prior to raising an event

1 comment |category: |Views: 21

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:

posted by jessejesse(100) 4 years, 2 months ago 0

Very nice sugar unless you rely on checking for null events to verify whether or not you have any subscribers for other behavior in your classes. The performance scenarios suggested in the comments are ridiculously unlikely. Anyone designing a framework where events with no subscribers still invoke 10k+ times in quick succession doesn't care about performance anyway, and probably won't understand the benefit of this technique in the first place ;)

Reply

information Login or create an account to comment on this story