Given that all controls in a WebForm are destroyed (by my understanding) at the end of each postback do you need to "unwire" any event handlers you may have wired up? (Assuming you want to stop handling the events and allow GC)
So for example:
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//Do I need to remove this handler?
btnSubmit.ServerClick += btnSubmit_ServerClick;
}
}
Unlikely. Your WebForm1
instance's lifetime ends just after the Unload event, if I recall correctly. It's not as though there is a continuing reference to your WebForm1
class after the page is served and cleanup is done.
No, you don't have to. They will be garbage collected.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With