Re: Unsubscribing from events.

From: Pete Davis (pdavis68_at_NOSPAM.hotmail.com)
Date: 03/15/05


Date: Tue, 15 Mar 2005 09:48:14 -0600

That's what my co-worker said, but I just wanted to be sure. Thanks
Nicholas.

Pete

"Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard.caspershouse.com> wrote in
message news:OcwHGPXKFHA.3184@TK2MSFTNGP09.phx.gbl...
> Pete,
>
> Yes, it works. I wouldn't waste the field to hold onto this. It's
the
> method that is the identity of the delegate, not the instance of the
> delegate itself.
>
> Hope this helps.
>
>
> --
> - Nicholas Paldino [.NET/C# MVP]
> - mvp@spam.guard.caspershouse.com
>
> "Pete Davis" <pdavis68@NOSPAM.hotmail.com> wrote in message
> news:87adnUDn277vYKvfRVn-ow@giganews.com...
> >I came across the following code in the .NET Framework:
> >
> > ((IBindingList) list).ListChanged -= new
> > ListChangedEventHandler(this.List_ListChanged);
> >
> > In other places, they hold onto a reference to the original event
handler
> > instance and unsubscribe that. I've always held the references and
> > unsubscribed the original myself.
> >
> > Unsubscribing from a new instance instead of the original instance just
> > seems wrong. Yet one of my co-workers claims this actually works. Does
it?
> >
> > Pete
> >
> >
>
>



Relevant Pages

  • Re: [OT] Re: Machines and people
    ... people reaching consensus is the result of magic. ... <holds and taps cigar> ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)
  • Re: Question about debian with HP/Compaq ML350G4
    ... Pete wrote: ... > We are buying a new server for web use and have decided it'll be the ML350 ... To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org ... The all-new My Yahoo! ...
    (Debian-User)
  • Re: promise sx4000 drivers
    ... get FreeBSD ... drivers someday. ... Pete ... To unsubscribe, ...
    (freebsd-performance)
  • Re: FreBSD & MPLS stack (fwd)
    ... Did they change the acronym from "Mostly Pointless Lamp Switching"? ... Pete ... To unsubscribe, ...
    (freebsd-net)
  • syslog -Wformat and %m
    ... with FreeBSD header files or gcc itself? ... Pete ... To unsubscribe, ...
    (freebsd-questions)