Do I need to unsubscribe from (manually subscribed to) events in asp.net?

后端 未结 2 1767
鱼传尺愫
鱼传尺愫 2020-12-20 22:02

Do the same best practis rules regarding subscribing/unsubscribing to events apply in asp.net?

I know it might seem like a silly question, but when I think about it,

2条回答
  •  青春惊慌失措
    2020-12-20 22:40

    Generally, no. Events are supposed to be dumped automatically when the page unloads. SUPPOSED to be. I've run into a bug before (in .NET 1.1) where that wasn't the case.

    I won't bother unsubscribing, unless I notice a problem with the page (like, a method being called 20 times from a phantom in the call stack: that's usually a sign of something not being unsubscribed properly).

提交回复
热议问题