Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the C# event system deterministic for single-thread programs? [duplicate]

Tags:

c#

events

Possible Duplicate:
Order of event handler execution

Is the C# event system deterministic for single-thread programs? That means, if I fire events A, B, and C in this order, will they be processed in the same order, every time?

I want to write a game logic which is heavily dependent on events, and it is crucial that the events are processed in exactly the order in which they are called. So can I use the given event system, does a library like Reactive Extensions satisfy this, or do I have to implement my own observer system?

like image 862
Hackworth Avatar asked Jan 09 '13 16:01

Hackworth


1 Answers

[ for single-thread programs, ] if I fire events A, B, and C in this order, will they be processed in the same order, every time?

Yes. Firing an event is just a complicated way to call a method. So it's equivalent to:

On a single thread, if I call methods A(), B() and then C() will they execute in that order?

Of course they will.

like image 127
Henk Holterman Avatar answered Oct 18 '22 19:10

Henk Holterman