var categories1 = _context.Categories.ToList();
var categories2 = _context.Categories.ToListAsync().Result;
var categories3 = await _context.Categories.ToListAsync();
var categories4Task = _context.Categories.ToListAsync();
// do some other work
var categories4 = await categories4Task;
In above fours statements, first statement is normal and in other three statements, asynchronous programing is used.
As per my knowledge, if we use async task and then to do some other work after the async task as done in categories4Task variable, it is useful as it will work in parallel and total execution time will be saved.
But in case categories2 we are taking result in same line by using Result property and also in categories3 we are using async and await in same line. How is this beneficial for us to use async and await in same line? Is this equal to categories1 query or not?
Can anyone explain please?