Re: Consuming your own events.

Greg Young <[email protected]>
Newsgroups gmane.comp.windows.devel.dotnet.clr
Message-ID <[email protected]>
I agree with Sebastien here ...but there is a problem that can be
introduced with ordering (when it is changed)... when do I need to tie
the event in order to be able to use it? With the overriden template
methods this problem doesn't exist.

On Jan 28, 2008 2:25 PM, Sebastien Lambla <[email protected]> wrote:
> > 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(R)  http://www.develop.com
>
> View archives and manage your subscription(s) at http://discuss.develop.com
>



--
Studying for the Turing test

===================================
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.