This is not really accurate. For classes that fire events, (such as the
Button class with the Click event), there is usually a method (named
On<Event>, in this case, OnClick) that is called to fire the events. This
method is usually marked as virtual, so that it can be overriden by classes
that derive from it. It is easier to put some specific logic in here than
attach a delegate to yourself (and it's quicker as well).
Usually, you will see this in classes overriding controls to paint
themselves, so they will override OnPaint.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"hillcountry74" <sh*******@yahoo.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
Hi,
I'm a newbie and trying to understand event handling in c#. I have
understood handling events using delelgate objects. But not this
method- "Event handling by overriding the virtual protected method of
the base class". Can someone please explain this with a sample code?
Thanks a lot.