T
The One We Call 'Dave'
Hi,
Various custom controls in my WinForms application register for the
'Application.Idle' event on load, and unregister on dispose. To avoid memory
leaks, it's essential that I remember to unregister on dispose.
Before my application exits, I'd like to do an 'assert' to assure myself
that there are no cases in which I've forgotten to unregister. I was under
the impression that an event is nothing more than a collection of delegates.
I therefore tried:
Debug.Assert(Application.Idle.Count==0);
This doesn't compile, however, and begs the question: Given an event
object, how do I obtain the underlying delegate collection?
Dave
Various custom controls in my WinForms application register for the
'Application.Idle' event on load, and unregister on dispose. To avoid memory
leaks, it's essential that I remember to unregister on dispose.
Before my application exits, I'd like to do an 'assert' to assure myself
that there are no cases in which I've forgotten to unregister. I was under
the impression that an event is nothing more than a collection of delegates.
I therefore tried:
Debug.Assert(Application.Idle.Count==0);
This doesn't compile, however, and begs the question: Given an event
object, how do I obtain the underlying delegate collection?
Dave