Re: Maintain list of attached event handlers (.Net 1.1)



"Armin Zingler" <az.nospam@xxxxxxxxxx> wrote in message news:OOTWuLBxHHA.1184@xxxxxxxxxxxxxxxxxxxxxxx
"Peter Duniho" <NpOeStPeAdM@xxxxxxxxxxxxxxxx> schrieb

[...]
> > > Why keep listening to events that will never occur?
> >
> > Having a delegate attachd to an event is not "listening".
>
> Use the word of your choice, but I call it listening.

And you called it "catching" too. That doesn't make it right. More
particularly, the word "listen" implies some sort of active role.

That's your interpretation. As I know what events are, I know what "listen
to an event" means. As you also know what events are, you should als know
what "listen to an event" means. I have used it in the past, unless when
teaching beginners, sufficient times without misinterpretation by the
reader.

You can use the word "listen" if you like, and we will even
understand you. My point is to be sure you understand that there is
no actual active listening going on.

You can be sure that I know this.

It hurts nothing to have a
delegate attached to an event, as that involves no actual run time
code execution.

Let me put it this way:
A basic programming rule that I (and not only I) always obey is: Clean up
references as soon as I don't need them anymore. There is no reason to
challenge this every time. Every time, I do not have to count the bytes
potentially freed, then decide if the amount legitimates writing the
removement of the reference. Instead, I simply remove it because I don't
need it anymore. That's the basis rule.

Technology changes. That changes basic rules. This rule, which used to be basic, needs to be challenged in an environment that includes garbage collection.

In .NET, it is only rarely a good idea to follow your basic rule.
--
John Saunders [MVP]

.



Relevant Pages

  • Song of the year - was: Ode to a Handle Cranker
    ... We can't make it here anymore ... It fed our kids and it paid our bills ... Some are working two jobs and living in cars ... If you're listening at all ...
    (alt.machines.cnc)
  • Re: Song of the year - was: Ode to a Handle Cranker
    ... > We can't make it here anymore ... > It fed our kids and it paid our bills ... > Some are working two jobs and living in cars ... > If you're listening at all ...
    (alt.machines.cnc)
  • Re: Song of the year - was: Ode to a Handle Cranker
    ... >We can't make it here anymore ... >It fed our kids and it paid our bills ... >Some are working two jobs and living in cars ... >If you're listening at all ...
    (alt.machines.cnc)
  • Re: Why is Stern so afraid of O&A?
    ... because I don't listen to either anymore. ... REAL story .. ... church thing - and I remember them getting suspended. ... I don't think I was listening ...
    (alt.fan.howard-stern)
  • Re: G. Gordon Liddy on the ports?
    ... contract for the Long Beach port. ... G-man is totally against it. ... I don't get his show anymore ... I'm listening RIGHT NOW!! ...
    (rec.sport.pro-wrestling)