I\'ve been stuck on this question for a while and haven\'t really found any useful clarification as to why this is.
If I have an async
method like:
If I use await here, what's the point of the asynchronous method?
await
does not block thread. MyMethod2
will run synchronously until it reaches await
expression. Then MyMethod2
will be suspended until awaited task (MyMethod
) is complete. While MyMethod
is not completed control will return to caller of MyMethod2
. That's the point of await
- caller will continue doing it's job.
Doesn't it make the async useless that VS is telling me to call await?
async
is just a flag which means 'somewhere in the method you have one or more await'.
Does that not defeat the purpose of offloading a task to a thread without waiting for it to finish?
As described above, you don't have to wait for task to finish. Nothing is blocked here.
NOTE: To follow framework naming standards I suggest you to add Async
suffix to asynchronous method names.