Closed GoogleCodeExporter closed 9 years ago
Also, in all cases where I have the virtual OnEvent method, the event handler
should be invoked in this method (doesn't matter exactly where in the body).
This is the standard used by the .NET guidelines. I originally avoided this to
specifically prevent overriding OnEvent and not calling the base class
resulting in the event still being invoked, but apparently that isn't the
approach used. Which makes sense since it provides more power to derived
classes, giving them the ability to mutate the event arguments (such as the
common Cancel event argument) before it is ever raised, effectively allowing
the derived class to fully handle and break execution of events.
Original comment by Spodiii
on 3 Dec 2010 at 7:30
When done converting, the following should go back to using custom event
handlers since they fire frequently enough (especially in the server) to
justify the micro-optimizing:
- ISpatial.Moved
- Possibly other ISpatial stuff
- Is there anything related to packet I/O being triggered?
Also, using only the .Raise() extension, I'm not going to be able to avoid
creating the EventArgs if there are no listeners, which sucks. Don't think
there is any good way around it, either. So I might have to continue to use the
if check before-hand just to avoid that needless (creating the EventArgs for
each event raise isn't so bad, but for each time an event CAN raise, that is a
lot...).
Original comment by Spodiii
on 4 Dec 2010 at 7:20
Original comment by Spodiii
on 6 Dec 2010 at 6:46
Original issue reported on code.google.com by
Spodiii
on 3 Dec 2010 at 7:15