The execution order of asynchronously called methods

When I call several methods on the Dispatcher, say UI Thread Manager,

like here

uiDispatcher.BeginInvoke(new Action(insert_), DispatcherPriority.Normal);
uiDispatcher.BeginInvoke(new Action(add_), DispatcherPriority.Normal);
uiDispatcher.BeginInvoke(new Action(insert_), DispatcherPriority.Normal);

will these methods be executed in the same order in which they were called?

+5
source share
2 answers

With the help Dispatcherthey will be executed in the same order in which they were called, but only because DispatcherPriority- the same. This is guaranteed behavior and is described in Dispatcher.BeginInvoke :

If multiple BeginInvoke calls are made with the same DispatcherPriority, they will be executed in the order in which the calls were made.

, , . , , . Coupling .

, , , . , , TPL, , .

+11

MSDN

BeginInvoke DispatcherPriority, , .

+5

All Articles