Answer the question
In order to leave comments, you need to log in
What is the difference between ActionResult and Task(ActionResult) and ToList() and ToListAsync()?
Below are two methods that essentially do the same thing, one of them is asynchronous.
[HttpGet]
public ActionResult Users()
{
return View(_userManager.Users.ToList());
}
[HttpGet]
public async Task(ActionResult) UsersAsync()
{
return View(await _userManager.Users.ToListAsync());
}
As I understand it, await _userManager.Users.ToListAsync() is executed on another thread, temporarily freeing the calling thread.
Is there any point in such asynchrony within a web application if, by freeing one thread, we occupy another?
Answer the question
In order to leave comments, you need to log in
await _userManager.Users.ToListAsync() is executed on a different thread, temporarily releasing the calling thread.
Is there any point in such asynchrony within a web application
Of course there is a difference. But to see this clearly, try to simulate a situation with 10,000 simultaneous users of your application. Google api load testing.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question