作者testPtt (测试)
看板C_Sharp
标题[问题] new EventHandler需要dispose吗?
时间Sat Jan 30 12:18:35 2016
假设我操做一个button1.Click会产生以下程式
this.button1.Click += new System.EventHandler(this.button1_Click);
那之後
private void button1_Click(object sender, EventArgs e)
{
//我需要呼叫dispose或插入以下程式码吗?
this.button1.Click -= new System.EventHandler(this.button1_Click);
}
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 36.237.253.95
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/C_Sharp/M.1454127517.A.4CB.html
1F:→ ssccg: 除非你只要按一次不然为什麽要移除? 01/30 13:55
2F:→ ssccg: 另外要移掉的是原本那个的话,你用 -= new 也不对 01/30 13:55