Yep. Have fun. Try not to lose as much hair as I have.. :/
i see the memory management issues now...The winforms, and long-lifetime objects ( delegate invocation lists ) holding refs to short lifetime objects ( windows forms ) is certainly an issue.
Weak references can't help you here can they? ( do you control both sides of the code ). I agree using dispose for this isn't too nice, and kinda against the spirit of the thing etc...
Been there, done that. The answer: not really. Firstly, the 'event' pattern is first-class in the framework so I have to deal with it (meaning that in many cases I do not control both sides of the code). Secondly, WeakReferences
only really introduce a new set of problems. Performance is one, but not as big a problem as 'what do I do if an event gets thrown to a dead object that hasn't been collected yet?'.
At the end of the day, I need to unsubscribe my events. So all that this 'managed environment' seems to have done for me has turn 'delete' into 'unbind', 'dispose', 'null'. It didn't become easier, it became harder. Meh.
Wow! i never knew that, thanks!. just checked the IL and it is essentially passing a stack pointer...
Yep. I checked the IL too. I only discovered this last week. Then I started grumbling about not having an 'in' keyword..
i'll get back to you on the others when i've had a chance to read the threads you sent etc.. ( work might get in the way this week )