In some cases, one might want to use inheritance to make specific versions of a broader event. When one only cares about the broader event, it should be possible to subscribe to that, rather than having to subscribe to each specific event manually (and being out of luck if any are added).
Currently, events are only passed to exact matches, but their hierarchy could be checked too.
For this purpose, the first thought might be an extra property for events - however polymorphism makes that impossible, as only the concrete type's value will be used. Rather, reflection would be the only way to do it, so an attribute should be added to each event base class type that should be useable on its own.
Going up an concrete event's type hierarchy, the check to pass it to handlers would then be:
Is the concrete type
Is a base type that:
Also implements the event interfaces (see also #6)
In some cases, one might want to use inheritance to make specific versions of a broader event. When one only cares about the broader event, it should be possible to subscribe to that, rather than having to subscribe to each specific event manually (and being out of luck if any are added).
Currently, events are only passed to exact matches, but their hierarchy could be checked too. For this purpose, the first thought might be an extra property for events - however polymorphism makes that impossible, as only the concrete type's value will be used. Rather, reflection would be the only way to do it, so an attribute should be added to each event base class type that should be useable on its own.
Going up an concrete event's type hierarchy, the check to pass it to handlers would then be: