In my program, sometimes a function needs to be executed when an event is fired, sometimes not, and there seems to be a problem with this. In order to understand that problem, I would like to know what happens in the following cases:
_manager.InputOkHandler += InputHandler; // add the InputHandler to the event.
...
_manager.InputOkHandler += InputHandler; // add the same InputHandler to the event again. (1)
...
_manager.InputOkHandler -= InputHandler; // remove an/the InputHandler from the event. (2)
... and at another moment:
_manager.InputOkHandler += InputHandler; // add the Input Handler to the event.
...
_manager.InputOkHandler -= InputHandler; // remove the InputHandler from the event.
...
_manager.InputOkHandler -= InputHandler; // remove an InputHandler from the event. (3)
- (1) : will the
InputHandler
be added twice? If yes, what does this mean? - (2) : will only one
InputHandler
be removed or both (if possible)? - (3) : will this raise an
Exception
? If yes, which one?
... and finally: is it possible to show a list of all "subscribed" functions/methods to an event and how?