© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•9mo ago•
39 replies
aetherclouds

Why use `await AbcAsync()` instead of `Abc()`

I'm going through the tutorial in this page: https://learn.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app/controller-methods-views?view=aspnetcore-9.0
I don't understand this bit of generated code inside an async controller method:
// . . .
_context.Update(movie);
await _context.SaveChangesAsync();
// . . .
// . . .
_context.Update(movie);
await _context.SaveChangesAsync();
// . . .

why call
_context.SaveChangesAsync()
_context.SaveChangesAsync()
and then immediately await it, instead of the synchronous version
_context.SaveChanges()
_context.SaveChanges()
(which does exist)?

I assume that this is because the async method will only temporarily free the thread to do other work once it hits an
await
await
, but that doesn't make sense, because that's the whole point of an async method (whether it uses
await
await
inside its body or not).
Part 6, controller methods and views in ASP.NET Core
Part 6, add a model to an ASP.NET Core MVC app
Part 6, controller methods and views in ASP.NET Core
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Why does Task 1 prints first instead of Task 3 - Async & Await
C#CC# / help
2y ago
❔ ✅ why properties instead of public fields
C#CC# / help
3y ago
✅ why is it '1' instead of '0'??
C#CC# / help
3y ago
✅ await await ContinueWith
C#CC# / help
9mo ago