I'm implementing a UserControl
which implements IMessageFilter
. It calls Application.AddMessageFilter
in its constructor. I'd like to remove it from the message filter in its Dispose(bool disposing)
method, but I don't know whether to place the call to Application.RemoveMessageFilter
inside the test (so it gets called when disposing
is true) or whether I should call it outside the test (so it gets called whenever the method is called).
Which is the right approach?