I have a Winform, i have added a few controls like Textbox, buttons. I subscribed to the textbox Changed event, teh button click event. The designer automatically adds the += statements i.e subsribtion of events in the designer.cs file.
My question is should we add the unregisterig of these events in the dispose function ? is it necesssary, or will there be any leak if i do not unregister. Or is it that .NET takes care of it开发者_如何转开发.
Refers to following link:
Is it bad to not unregister event handlers?
This is not required to unregister events that is subscribed on same class.
If your WinForm is the only one that is consuming/subscribing to it, then you dont need to worry about unsub.
精彩评论