What are the advantages of using class type events over enum events?
Initially, I thought using class typed events like the ones in Prism is better because the events can be checked at compile time. But after some thoughts, this seem to apply only to string quoted events. Enum events seem quite okay too. It can still be checked at compile time, and it can be refactored quite easily too.
By class typed events, I meant something like this:
eventAggregator.GetEvent<MouseEvent>.Publish(eventArgs);
Whereas enum events could look something like this (something like how events in Flex work):
eventAggregator.Publish(MouseEvent.Double_Click, eventArgs);
Then, what are the advantages and disadvantages of using class typed events over enum events? And what are the disadvantages of enum events?
The only time an enum event might have some small benefit is when numerous events should trigger the same piece of code. However this small benefit is fairly insignificant when compared to the more common disadvantage when each event should trigger different code. Assuming you’re creating some kind of library if you can imagine a developer making multiple events synonymous within their application it’s a pretty good sign that your events aren’t very clearly defined and could probably stand a redesign.