From the course: Threading in C#

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Tasks with continuation demo

Tasks with continuation demo - C# Tutorial

From the course: Threading in C#

Start my 1-month free trial

Tasks with continuation demo

- [Instructor] Let's look at an example with a similar kind of project, except this time, we are going to use TaskChaining. First, we'll do the same exact thing we did earlier where we will create a task. You don't really have to call it antecedent. I just wanted to make sure that we use the same vocabulary we just used so you can see what's going on. This could be a task that does nothing more than taking the DateTime and finding what's the day today at the server or at whatever machine this code is running in. Could be, also, the client. In this case, it is the client, and we have DateTime.Today, and then I could say ToShortTime or ShortDateString. Once I have that, I've got the data. However, what I like to do is pass this data to the continuation and have the continuation do something with it. As you notice, I'm not going to say Task.Run again because that would mean it's a completely different task, and they don't have any relationship whatsoever. So I use antecedent and then say…

Contents