What should the ending of IAsyncEnumerable methods and variables be? Do we need a convention? #107237
-
I've seen no ending, For variables if I have a method Should I assign it to I looked in the code of dotnet org and seems like there's not convention on this. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
Our convention is to use an Async suffix. |
Beta Was this translation helpful? Give feedback.
-
System.Linq.Async ends all their IAsyncEnumerables with |
Beta Was this translation helpful? Give feedback.
-
@stephentoub why is your new Select is not SelectAsync? I assume this is because it doesn't have |
Beta Was this translation helpful? Give feedback.
-
Unless you plan to offer both synchronous and asynchronous versions, a method should plainly indicate what it returns and should not use async suffix: Similar logic applies to variables: please do not name them Keep in mind that CoreLib and .NET internals are subject to an outdated convention that cannot be changed due to consistency and high explicitness considerations. However, luckily, the code outside can follow a less cumbersome convention. |
Beta Was this translation helpful? Give feedback.
Our convention is to use an Async suffix.