G
Guest
Having to remember to unregister for events to prevent a ref count seems to
be quite a burden to place on a developer. I have reviewed the
WeakMulticastDelegate solution proposed by Xavier Musy
(http://www.seedindustries.com/blog/x/2004_06_01_archive.html) and Greg
Schechter’s Avalon solution.
1) Is there a more general solution in C#?
2) Why are delegates not weakreferences? It would seem a logical decision to
make - if the only reference to an object is as an event handler it would
seem that it should be GC'd. Weak references would allow for this.
Andrew
be quite a burden to place on a developer. I have reviewed the
WeakMulticastDelegate solution proposed by Xavier Musy
(http://www.seedindustries.com/blog/x/2004_06_01_archive.html) and Greg
Schechter’s Avalon solution.
1) Is there a more general solution in C#?
2) Why are delegates not weakreferences? It would seem a logical decision to
make - if the only reference to an object is as an event handler it would
seem that it should be GC'd. Weak references would allow for this.
Andrew