Dispatch? I'd like to make a call. The difference between Synchronization Context, Task Scheduler and Dispatcher
I recently had to deal with cleaning up Dispatcher based UI update code in a WPF application. I am struck after so many years that like garbage collection (think IDisposable ) and threading, there still does not exist a clear understanding or explanation of how to marshal across threads, the benefits of using constructs like the SynchronizationContext to do so, and what problem(s) it solves. I thought it might be instructive to demonstrate the various techniques available to developers using the WPF framework for illustrative purposes. Keep in mind that the concepts outlined here apply not just in WPF, but anywhere where business logic code meets UI presentation. Given a Dispatcher object and the SynchronizationContext object, which one should you choose, and what are the compelling reasons for doing so? Note: This post was inspired from an answer I posted on StackOverflow to this very question. Perhaps it would help to explain what problem the SynchronizationCo