Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions _rules/1755.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
rule_id: 1755
rule_category: naming-conventions
title: Postfix asynchronous methods with `Async` or `TaskAsync`
title: Only use `Async` or `TaskAsync` as a suffix when a method has both synchronous and asynchronous versions
Comment thread
bkoelman marked this conversation as resolved.
severity: 2
---
The general convention for methods and local functions that return `Task` or `Task<TResult>` is to postfix them with `Async`. But if such a method already exists, use `TaskAsync` instead.
Only suffix a method or local function that returns `Task` or `Task<TResult>` with `Async` if there is also a synchronous variant of that method. If no synchronous variant exists, the `Async` suffix adds unnecessary noise. If both synchronous and asynchronous variants exist, use `Async` as the suffix. If a method suffixed with `Async` already exists, use `TaskAsync` instead.