IMplatform, you just need to un-subscribe from A's event...
About the
only reliable place to do this in a Dispose method; assuming
you're
deterministically disposing of your object (via
"using" or calling Dispose
directly). In most cases, the un-subscribe can be done
similarly to the
subscribe by simply by changing the += to -=:
objectA.SomeEvent -= new
EventHandler(this.objectA_SomeEvent);
As Ryan says, if you don't un-subscribe from events before
the subscribed
object is collected you'll have "leaks".
Apologies if this was repeated; the listserv whined that it
thought my
previous was a command not a message (I'm presuming my use
of un-subscribe
without the hyphen caused that. If so, yuck...)
===================================
This list is hosted by DevelopMentorŪ http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com
|