Handlers removed automatically?
-
Hi, In winforms or wpf application, lets say there is one container control which adds controllers dynamically and it also adds event handlers of that child controls. Now if I call a clear method of the parent container control, will the event handlers added be removed automatically? If not and I dont remove them (event handlers), will it create any other issue? Please suggest! Thanks, Divyesh
-
Hi, In winforms or wpf application, lets say there is one container control which adds controllers dynamically and it also adds event handlers of that child controls. Now if I call a clear method of the parent container control, will the event handlers added be removed automatically? If not and I dont remove them (event handlers), will it create any other issue? Please suggest! Thanks, Divyesh
when you clear a container control, it disposes of all the contained controls; each control will be available for garbage collection, and the event members they contain will have no influence, just like any other data members. There is no need to remove handlers at all. BTW: The same applies to a modeless form that gets closed. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.