c# - Are there any performance drawbacks to using 'do nothing' default event handlers? -


Assume that I have a collection of thousands of objects, all of which apply the following:

  Public Event EventHeader Status Based = (S, E) = & gt; {}; Private Zero ChangeStatus () {StatusChanged (This, New EventArgs ()); }  

If any handler is not subscribed to that event for each object, does an option use event handlers which provides any performance loopholes? Or is CLR smart enough to ignore it? Or am I checking a StatusChanged handler before firing events?

Yes, CLR is not really very clever, but can be done to ignore it, but In most cases, this difference should be negligible.

A method call is not a big deal and there is no possibility of a meaningful effect on the performance of your application.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -