C# pattern to prevent an event handler hooked twice [duplicate]
问题 This question already has answers here : How to ensure an event is only subscribed to once (5 answers) Closed 4 years ago . Duplicate of: How to ensure an event is only subscribed to once and Has an event handler already been added? I have a singleton that provides some service and my classes hook into some events on it, sometimes a class is hooking twice to the event and then gets called twice. I'm looking for a classical way to prevent this from happening. somehow I need to check if I've