December 9, 2015

A Short and Easy Introduction to .NET's Task Class

Task.Run You can use Task.Run to schedule a delegate to run on the thread pool. The method returns a new task, and if the work is complete, the result will be available via Task.Result. If not, Task.Result will block until it is complete. Task.ContinueWith You'll want to avoid accessing the Task.Result property because it will block until the result is ready. In the previous example, the UI will hang for about 2000 milliseconds before updating the label with the result. Read more

© Joe Buschmann 2020