Re: Consuming your own events.

Sebastien Lambla <[email protected]>
Newsgroups gmane.comp.windows.devel.dotnet.clr
Message-ID <[email protected]>
> I've definitely fixed bugs in the last year by *removing* the event
> handler and installing this pattern. The documentation does say
> (somewhere) that for certain events such as Load, a class's behavior
> will be undefined if it listens for the event on itself.

This is not a CLR issue though, but a classlib design. If your class can
have undefined behaviour if someone forgets to call the base class
implementation, you either have a weak documentation or a weak
implementation. Maybe both.
>
> -----Original Message-----
> From: Discussion of development on the .NET platform using any managed
> language [mailto:[email protected]] On Behalf Of Greg
> Young
> Sent: Monday, January 28, 2008 2:42 PM
> To: [email protected]
> Subject: Re: [DOTNET-CLR] Consuming your own events.
>
> Events are slower than a simple virtual method call ... also if there
> is
> an exception in another event handler your code is not guarenteed to be
> called where as with the OnXXX pattern (event template methods) your
> code will be called before the event is actually raised.
>
> On Jan 28, 2008 8:59 AM, Brady Kelly <[email protected]> wrote:
> > I came across a mention in an article last year, advising on not
> > consuming your own events, e.g. not using a Form_Load handler on your
> > form, but overriding OnLoad.  What is the story behind this, and is
> it
>
> > a UI thing I should ask about elsewhere, or a more general pattern?
>
> ===================================
> This list is hosted by DevelopMentor.  http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.