Hi,
Is there a way to release all event subscriptions for a particular event, without adding extra subscription tracking code?
In C# you can set the delegate to null, but the ABL implementation of events hides (or doesn't have) this...
As far as I know, this is not possible. What I would like is to have some reflection functions on pub/sub together with the ability to dynamically add and delete subscriptions.
Your only option currently is to check on some global condition at the start of your event handler.
Adding code at the handler side isn't ideal (you can't force that).
The only workaround I see is not use events or make them private, and use an observer pattern.
Since you somehow need to keep track of all observers, you can also release them at will...
A welcome addition to the language could be an UnsubscribeAll() method on the event...