I stumbled over this code snippet at How to remove all event handlers from a control :
void OnFormClosing(object sender, FormClosingEventArgs e)
{
foreach(Delegate d in FindClicked.GetInvocationList())
{
FindClicked -= (FindClickedHandler)d;
}
}
My question is: assuming that the form is about to be disposed (after being closed), would the snippet be required or would FindClicked
and all references to event handler delegates simply go down with the form when it is GC´ed (which the referenced event handlers shouldn't cause any problems with)?