Do you need to remove an event handler in the destructor?

后端 未结 9 1035
情书的邮戳
情书的邮戳 2021-01-31 01:22

I use some UserControls which get created and destroyed within my application during runtime (by creating and closing subwindows with these controls inside).
It

9条回答
  •  北恋
    北恋 (楼主)
    2021-01-31 02:09

    2) This does work

    1) I had a case ( with an In-App messaging service ) that event handlers to a global object where not released and the GC couldn't collect the object because of that. I think this is usually a rare condition - using a profiler like ANTS from red gate you could easily do a memory profiling if you think this happens to to you.

提交回复
热议问题