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

后端 未结 9 1204
情书的邮戳
情书的邮戳 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:03

    If the code got to the destructor, it doesn't matter anymore.

    That's because it will only be destroyed if it isn't listening to any events anymore.
    If it was still listening to events, it wouldn't have been destroyed.

提交回复
热议问题