I have a question about cross links in .Net.
As I know we should break up a cross link between objects if we want they are released by GC. So, sometimes there is a situation when I have an object with link to another object and that object has back link, but through an event. As i know if one object has a subscription to another, the second one has a link in its event in the target object property or in the invocation list for more than one subscription.
Must I always decouple these objects by myself(realizing Dispose method for example) or there is an another way for this kind of situation in .Net or may be .Net clean event links by itself?
Only when you do no longer need one of both (say A) you need to remove all references to A.
This includes any eventhandlers of event on A.
If A can be collected at the same time as the objects that refer to it, there is no reason to remove the references between these objects. Just remove all references to all of these objects from objects that need to stay ‘alive’ and the garbage collector will see that all these objects are no longer reachable and clear them up when needed.