From the course: Asynchronous Programming in C#
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Challenge: Create and continue a task - C# Tutorial
From the course: Asynchronous Programming in C#
Challenge: Create and continue a task
(upbeat funky music) - [Instructor] In this challenge, you'll get a chance to practice creating and executing a task on a background thread and using a continuation to process the results produced by the task. The first step is to write a function to perform some calculations. I want you to write a function that will calculate all the factors of a given positive integer. There are probably several ways to do this but I'll be using the modulo operator in a simple loop. Next, I want you to execute your new function with a task on a background thread. When your task is complete use a continuation to log the results to the console. You could also add a couple of additional log statements just so you can see you're not blocking the main thread if you like. I'll present my solution in the next movie.