Skip to content

Instantly share code, notes, and snippets.

@mclasson
Created July 15, 2013 12:22
Embed
What would you like to do?
private void Dispose(object sender, EventArgs e)
{
if (ev_Click == null)
return;
foreach (var w in ev_Click.GetInvocationList())
{
using (var x = w.Target as IDisposable)
{
x.Dispose();
}
}
countLabel.Text = "InvocationList contains " + (ev_Click == null ? 0 : ev_Click.GetInvocationList().Length) + " objects";
memoryLabel.Text = "Memory consumption:" + GC.GetTotalMemory(true) / 1024;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment