Clearing subscriptions: What will break this self-cleaning event publisher?
问题 I've been studying garbage collection and event handlers, and in my studies, I came across some code that appears to clean all subscriptions, anonymous or otherwise, from an event handler. The code is as follows: public event CustomEventHandler customHandler; ... ///Something somewhere subscribes to the customHandler ... ///Method used for cleanup void ClearSubscriptions(CustomEventHandler handler){ if(handler == null){return;} Delegate[] delegates = handler.GetInvocationList(); foreach