After doing some reading I understand that handlers invocation order is the same order as subscribed but it is not guaranteed .
So lets say I have :
public event MYDEl ev;
and subscribers do :
ev+=GetPaper;
ev+=Print;
ev+=EjectPaper;
What is the best practice mechanism of preserving +assuring the execution list order ?
If it’s a field-like event, it will use simple delegate combination as per
Delegate.Combine, and that is guaranteed to preserve subscription order. From the docs for the return value:In general for events, nothing is guaranteed – it’s up to the implementation. Heck, it could ignore every subscription you ever make. In reality though, any sane implementation will preserve ordering.
EDIT: Sample of a mischievous event implementation:
This is just like writing a property which (say) returns a random number from the getter and ignores the value in the setter. It’s more of a theoretical problem than a real one.