我想知道这种事件的使用是否会导致 Silverlight 中的内存泄漏?
private void Button_Click(object sender, RoutedEventArgs e)
{
var test = new ChildWindow();
EventHandler closedEvent = null;
closedEvent =
(s, args) =>
{
test.Closed -= closedEvent;
if (test.DialogResult == true)
{
// something
}
};
test.Closed += closedEvent;
test.Show();
}
我有十几个 Closed 事件的示例用法,它们是有线和泄漏的。只是想知道这个样本是否会消除内存泄漏?谢谢。