I have event, for example like that:
public event EventHandler<NewReadyMessageEventArgs> NewReadyMessage
The problem is that i need to attach two handlers to it and i need to execute one before another (because the last one depends on first one). I.e. I need certain order of handlers execution.
I understand that in reality handlers will be executed one by one and so I just need to attach them in right order but that would be very error-phrone design.
I want to create separate handler and attach it. In this handler I just want to execute my two handlers in right order. What do you think and what would you suggest?
I would not rely on the internal implementation to ensure that the handlers get called in a specific order.
If the handlers can’t know about each other but you need them to run in a certain order I would create a “parent” handler that calls the other two handlers in the correct order.