This repository was archived by the owner on Jan 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Inconsistent naming of async methods #1009
Copy link
Copy link
Open
Description
I know it's not an issue in general, but there is no consistent sceme of naming async methods, at least none I noticed.
Also all async methods should include the Async
Suffix.
The name of an async method, by convention, ends with an "Async" suffix.
for exmaple:
public async Task<IViewComponentResult> InvokeAsync() { ... }
private async Task<int> CountTotalBasketItems() { ... }
private string? GetAnnonymousIdFromCookie() { ... }
For consistency CountTotalBasketItems()
should also have the Suffix like InvokeAsync()
another example:
public void OnGet(CatalogItemViewModel catalogModel) { ... }
public async Task<IActionResult> OnPostAsync() { ... }
All fine up here, BUT:
https://github.com/dotnet-architecture/eShopOnWeb/blob/main/src/Web/Pages/Basket/Index.cshtml.cs
public async Task OnGet() { ... }
public async Task<IActionResult> OnPost(CatalogItemViewModel productDetails) { ... }
public async Task OnPostUpdate(IEnumerable<BasketItemViewModel> items) { ... }
Metadata
Metadata
Assignees
Labels
No labels