If all you need to do is execute some long-term code that uses CPU intensively in the background thread, and when this is done, process the result in the user interface thread, use Task.Run() in combination with await :
async Task AMethod() { var result = await Task.Run(() => LongRunningWork()); DoSomethingWithResult(result); }
AMethod() now an async Task method, which means that its caller must also be an async method.
svick source share