Not an issue, but rather a question
Closed this issue · 1 comments
Hi Jon,
I'm confused by what you're trying to demonstrate with this bit of code - please do enlighten me. I have forked your code and it seems as though the value of 10
is never actually returned, but instead the value of 0
. I was anticipating "After Await" to be logged to the console - I'm certain there is a corresponding explanation... please do tell.
Thank you
This is just demonstrating how that it compiles - it's not a fully-functional task by any means.
It completes immediately because IsCompleted
returns true - we're never doing any of the work to actually fire continuations etc.
(This is an area I haven't researched deeply yet, as I haven't got to that section in writing C# in Depth. This is more "Hey, here's a feature you'll consume in terms of using ValueTask<T>
, but you'll almost certainly never want to write your own task-like type. If you do, this is what the skeleton of the code would look like.)
You should be able to tweak your fork of the code to explore it though.