Skip to content

Instantly share code, notes, and snippets.

@mclasson
Created July 15, 2013 12:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mclasson/5999561 to your computer and use it in GitHub Desktop.
Save mclasson/5999561 to your computer and use it in GitHub Desktop.
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