我有一个派生自 System.Windows.Form.Form 的“MyForm”。MyForm 处理我在构造函数中设置的处理程序的 FormClosed 事件。实例化的 MyForm 对象是否可以使用 -= 成功删除我的 MyClass#FormClosed 处理程序?如果这很重要,我正在使用匿名方法来连接我的 FormClosed 事件。
// In MyForm Constructor, this ALWAYS gets fired...
FormClosed += (_sender, _args) => { m_mutex.Dispose(); m_mutex = null; };
// In Instantiating Class
MyForm form = new MyForm();
form.FormClosed += (_sender, _args) => { };
// I have also tried using "delegate(object sender, EventArgs e)" and neither worked.