event subscription question

  • Thread starter Thread starter Dan H.
  • Start date Start date
D

Dan H.

lets say i have an object with a bunch of events called ObjectA.

i subscribe to ObjectsA events with ObjectB methods

I set ObjectA to null.



what happens to my subscriptions?

Will ObjectA get garbaged collected?

If I set ObjectA to another object of the same type, will the subscriptions
switch?

Thanks in advanced!

Dan
 
Dan H. said:
lets say i have an object with a bunch of events called ObjectA.

i subscribe to ObjectsA events with ObjectB methods

I set ObjectA to null.

what happens to my subscriptions?

Nothing - if the object is garbage collected, then the delegates will
become eligible for garbage collection too.
Will ObjectA get garbaged collected?

Only if there aren't any other references to the object.
If I set ObjectA to another object of the same type, will the subscriptions
switch?

No.
 
Back
Top