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.
1 2 3 4 5 6 7 8 9 10 11 12 private void button_Click(object sender, EventArgs e) { Task<DateTime> task = Task.Run(() => GetDateTime()); lblDateTime.Text = task.
Read more