KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
If I am assigning an event handler at runtime and it is in a spot that can be called multiple times, what is the recommended practice to prevent multiple assignments of the same handler to the same event. object.Event += MyFunction Adding this in a spot that will be called more than once will execute the handler 'n' times (of course). I have resorted to removing any previous handler before trying to add via object.Event -= MyFunction; object.Event += MyFunction; This works but seems off somehow. Any suggestions on proper handling ;) of this scenario.
Tags (comma-separated)
Save Edits
Cancel