I am using Dispatcher
to switch to UI thread from external like this
Application.Current.Dispatcher.Invoke(myAction);
But I sa
SynchronizationContext
is an abstraction that uses virtual methods. Using SynchronizationContext
allows you don't tie your implementation to a specific framework.
Example: Windows Forms uses the WindowsFormSynchronizationContext
that overrides Post to call Control.BeginInvoke
. WPF uses the DispatcherSynchronizationContext
type that overrides Post to call Dispatcher.BeginInvoke
. You can design your component that uses SynchronizationContext
and doesn't tie implementation to a particular framework.