Kenneth,
You don't have to worry about this. When you create the delegates to
attach to your event handler, you are storing a reference to an instance of
a class (the delegate) which holds an instance to another class (the
callee). When you set the last reference to your object to null, the
references it holds do not count towards keeping another instance alive.
Because of that, you don't have to do anything.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Kenneth Baltrinic" <ke*****@baltrinic.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I have a custom collection class that raises OnAdd and OnRemove events.
It is used by another class (Class A) as a container for the class's
children. Thus in class A's constructor, I instantiate an instance of the collection
class and register event handlers for the two events. For a give instance
of Class A, when is the appropriate time to release these handlers prior
to the instances destruction?
--Ken Baltrinic