As an example I have an ASP.NET Core API controller fetching some data from a service and 2 possible ways to implement the controller method:
With async/await:
[HttpGet]
public async Task<IActionResult> GetSomeDataAsync()
{
return await someService.GetSomeDataAsync();
}
Without async/await:
[HttpGet]
public Task<IActionResult> GetSomeDataAsync()
{
return someService.GetSomeDataAsync();
}
Which one of these two is better? The key here is that there is only 1 call to another async method (someService.GetSomeDataAsync()).