Re: Unsubscribing from events.
From: Pete Davis (pdavis68_at_NOSPAM.hotmail.com)
Date: 03/15/05
- Next message: Daniel Passwater via DotNetMonster.com: "Editing a registry key value in a batch file"
- Previous message: Pete Davis: "Re: .NET Remoting/Serialization way too slow vs C++ binary/tcp"
- In reply to: Nicholas Paldino [.NET/C# MVP]: "Re: Unsubscribing from events."
- Messages sorted by: [ date ] [ thread ]
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
> >
> >
>
>
- Next message: Daniel Passwater via DotNetMonster.com: "Editing a registry key value in a batch file"
- Previous message: Pete Davis: "Re: .NET Remoting/Serialization way too slow vs C++ binary/tcp"
- In reply to: Nicholas Paldino [.NET/C# MVP]: "Re: Unsubscribing from events."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|