From the course: Advanced 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.

Continuation with state

Continuation with state - C# Tutorial

From the course: Advanced Threading in C#

Start my 1-month free trial

Continuation with state

- [Instructor] Now that we've looked into cancellations, if you remember, in the previous course, not the pervious module, you actually had done something called task continuations, where we had an antecedent and then we were able to get the result from the antecedent in the continuation task. Now this is continuation, except this time we are going to pass state with continuation. And every single continuation task could actually have a state. So we'll start with a very simple function, more like a public static function that returns anything, it could return anything whatsoever. For now we'll just make it simple and say return the date time, and then simply say date time dot now. So we need a task to run this and we need the return type of date time. And we'll say task equals task dot run. And we don't need to specify the type here, 'cause it automatically knows that it is going to be date time, 'cause that's what we're expecting on the other side. We complete the action, which is a…

Contents