When working with frameworks like Silverlight, WPF or Windows Forms you often encounter the need to ensure a piece of code runs on the UI thread. Below, I present a clean way to do this using the SynchronizationContext class.