Listener.Destroy
Method
Visual Basic
Overrideable Public Sub Destroy
()
C#
public virtual void Destroy
();
Purpose
Destroy a listener, canceling interest.
Remarks
Destroying a listener cancels interest in its subject. Upon return from Listener.Destroy, the destroyed listener is no longer dispatched. However, all active callback methods of this listener continue to run and return normally, even though the listener is invalid.
It is legal for an event handler delegate to destroy its own listener.
Destroying listener interest invalidates the listener object; subsequent API calls involving the invalid listener throw exceptions, unless explicitly documented to the contrary.