Michael said:
Peter, please slow down for a moment and try to read my post.
Right back at you.
I was writing about the two negative outcomes to failing to call the
base class: one is that the OnLoad method itself does not get called;
the other is that failing to call the base OnLoad also results in a
failure for the event to be raised.
Somehow, you seem to have missed this point.
I'm fairly
convinced that you are scanning over what I've written too quickly and
basically getting the completely wrong idea and going off on a tangent.
Yes, I can see that you are convinced. If you would spend a little more
time reading my post rather than just assuming I'm blowing you off, you
might not be so convinced.
I'm not talking about failing to raise an event, I'm talking about failing
to *subscribe* to the event, ie the line
this.Load += new whatever
I know.
is missing. If you still have the Form_Load routine in your code then it
appears to the programmer that everything is fine. *Every* time this line is
missing it will be a problem. On the other hand if you fail to call OnLoad
in the override this will not be an issue in most cases. This is why I say
the OnLoad is potentially more reliable because if it's there in code then
it is getting called.
And my point is that there are really two parts to this question: is the
original implementation correct? And is a derived implementation correct?
Answering the first part is easy: either it works or it doesn't. If you
properly subscribe to the event, you're fine. Since you made the
original design decision to subscribe rather than override, presumably
it is trivial to subscribe correctly.
Answer the second part is harder, because you are not in control of the
derived implementation at the point in time that you write the base
implementation. But as far as that goes, the derived implementation can
mess up either the event-based implementation or the override based
implementation, and it will mess them both up in the same way: it will
fail to call the base class's method.
This originally came up in the context of you claiming that even though
the programming errors involved are "possibly both equally likely", that
it was the case that "The event is a problem in 100% of cases where the
override might be a small percentage".
You have yet to post something that explains exactly what percentages
you're talking about, never mind explains the math involved.
Check google, it is fairly well known that events have a larger overhead.
I checked Google, and it had nothing to say on the topic that supports
your claim.
If you want to make a claim, back it up. If you can't back it up, then
you have no business making the claim. And no, saying "look it up" is
not backing up the claim. If you yourself cannot readily provide the
references to justify the claim, then you yourself do not have the
first-hand knowledge required to legitimately make the claim.
Pete