C# web scaffolding has an async call for every member. Why?
For example: Async for a login call makes no sense. User has to wait for validation. What else would the app do until the application validated the user.
Thoughts?
asynclogin
C# web scaffolding has an async call for every member. Why?
For example: Async for a login call makes no sense. User has to wait for validation. What else would the app do until the application validated the user.
Thoughts?
Best Answer
The purpose of
async
is not to return a value immediately; it is to allow your code to work on something else while your methodawait
s a return value.async
doesn't magically make your method run faster. It still has to compute a result. Whatasync
does do is make your code non-blocking on the server, and it can often do it without spinning up additional threads, because it merely reorders your code while respecting the order of return values.To find out more about how this process works, read this MSDN article.