December 2019
Intermediate to advanced
346 pages
9h 8m
English
In the preceding example, we changed the return type of the method from IAsyncResult to Task<IAsyncResult>. There can be three return types from async methods:
All async methods must return a Task in order to be awaited (using the await keyword). This is because, once you call them, they don't return immediately, but rather, they execute a long-running task asynchronously. In doing this, the caller thread may switch in and out of context as well.
void can be used with asynchronous methods where the caller thread doesn't want to wait. These methods can be any operation that can happen in the background that's not part of the response being returned to the user. For example, logging and auditing ...
Read now
Unlock full access