Tasks and asynchronous programming became so much more clear after I saw your video about this from 7 (!) years ago.. This is a good addition and I really like how you make the step to the return value of ContinueWith (it is what I do when I try to understand the puzzle). I'm still a little bit, although it won't matter for working with tasks, why the first method is async and the second method is just the task.
Whenever we use "await", the method needs to be marked with the "async" modifier (this was a language design decision because "await" was not a reserved word in C#). In the first method, "async" does not make the method asynchronous; it just specifies that "await" should be treated in this special way. Since the second method does not use "await" anywhere, it does not need the "async" modifier on the method. But both methods are asynchronous.
@@jeremybytesYes, they are both async, but you should pass, in my opinion, ContinuationOptions.RunSync to each continuewith call to mitigate potential boxing. Passing this basically causes the continuations to run like the initial Task run, since it is sync before await gets called. If it can finish BEFORE you await it, then the statemachine wont ever reach AwaitOnComplete() which calls boxing of both the awaiter and the statemachine(asyncmethod).
Tasks and asynchronous programming became so much more clear after I saw your video about this from 7 (!) years ago.. This is a good addition and I really like how you make the step to the return value of ContinueWith (it is what I do when I try to understand the puzzle). I'm still a little bit, although it won't matter for working with tasks, why the first method is async and the second method is just the task.
Whenever we use "await", the method needs to be marked with the "async" modifier (this was a language design decision because "await" was not a reserved word in C#). In the first method, "async" does not make the method asynchronous; it just specifies that "await" should be treated in this special way. Since the second method does not use "await" anywhere, it does not need the "async" modifier on the method. But both methods are asynchronous.
@@jeremybytesYes, they are both async, but you should pass, in my opinion, ContinuationOptions.RunSync to each continuewith call to mitigate potential boxing. Passing this basically causes the continuations to run like the initial Task run, since it is sync before await gets called. If it can finish BEFORE you await it, then the statemachine wont ever reach AwaitOnComplete() which calls boxing of both the awaiter and the statemachine(asyncmethod).
Greate job ❤, congrats to go many more milestones 🎉🎉🎉🎉🎉🎉