Handles vs. AddHandler

前端 未结 7 480
花落未央
花落未央 2021-01-15 18:53

Is there an advantage to dynamically attaching/detaching event handlers?

Would manually detaching handlers help ensure that there isn\'t a reference remaining to a d

7条回答
  •  长发绾君心
    2021-01-15 19:30

    I manually attach handlers when I manually create controls (for example, dynamically creating a TextBox for each database record). I manually detach handlers when they are handling things I'm not quite ready to handle yet (possibly because I'm using the wrong events? :) )

提交回复
热议问题