If the differences are moot, then it should not be a factor in using
an event handler or an override.
The best you've come up with as an argument in favor of using an event
handler is aesthetic in nature. If we're talking aesthetics, then a
performance difference -- even if moot -- is fair game, as I find things
that perform better to be aesthetically superior.
Also, do you have any evidence to support your theory that delegates
work the same as a virtual method, but have additional work instead?
You assert that as fact, yet I haven't seen any documentation that
suggests that's the case.
They are both essentially function pointers. However, a virtual method is
always just a single function pointer, and I doubt any type-checking has
to be done at run-time, since all the relevant information is available
for checking at compile time. On the other hand, an event is a list of
delegates, so at a minimum that list has to be enumerated. Even if
there's only one element, that's more work than just dealing with a single
function pointer. Furthermore, delegates are type-safe and not checkable
at compile time, so there's extra work to deal with that.
Do I have documentation that describes all of the above? No. And yes,
it's entirely possible that between the C# compiler and the .NET Framework
implementations, those responsible for the implementations screwed up and
caused event handling to be more costly than using virtual methods. But I
think the likelyhood of that is _extremely_ low. The basic mechanics
dictate that event handling is more costly than dealing with virtual
methods, and the implementations would have to be pretty poor for them to
not follow that conclusion.
That said, I find this argument to be just as silly as all the other silly
arguments that show up here, and I'm embarassed to have been a part of
it. The fact is, you can do it either way, and there is no very strong
argument in favor of either method. If you prefer to go against the MSDN
documenation recommendation to override the OnFormClosing method in the
Form class, it's not really going to hurt much to do that. Just don't go
around pretending that there's a strong argument in favor of *not*
overriding.
Pete