You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Require either async override or override async (don't allow both)Β #43606
For some more information on which one should be chosen if one should be chosen, C# supports both forms, but override async is used about 12x more than async override in open source projects. Also, doing override async would keep in line with having the readonly keyword appear after override as mentioned in that linked issue, Additionally, override async is winning big time in this poll I did.
Right now, it seems like the declare keyword is the only modifier whose order isn't enforced.
just like public/private, override is something of an internal annotation (for implementors), while async is a more external annotation (for consumers).
Therefore, it makes sense to me to spell it as public override readonly async someMethod() which follows a consistent direction of moving along a spectrum from implementor-relevant towards consumer-focused (left-to-right).
Activity
dsherret commentedon Apr 9, 2021
For some more information on which one should be chosen if one should be chosen, C# supports both forms, but
override asyncis used about 12x more thanasync overridein open source projects. Also, doingoverride asyncwould keep in line with having thereadonlykeyword appear afteroverrideas mentioned in that linked issue, Additionally,override asyncis winning big time in this poll I did.Right now, it seems like the
declarekeyword is the only modifier whose order isn't enforced.fbartho commentedon Apr 9, 2021
just like
public/private,overrideis something of an internal annotation (for implementors), whileasyncis a more external annotation (for consumers).Therefore, it makes sense to me to spell it as
public override readonly async someMethod()which follows a consistent direction of moving along a spectrum from implementor-relevant towards consumer-focused (left-to-right).fbartho commentedon Apr 9, 2021
To put it another way:
asyncapplies to the right tosomeMethod()readonlyapplies to the instance (what you can do to an instance)overrideandpublicboth apply outwards to the class or meta levelSo working from the outside in
meta -> instance -> methodbecomespublic override readonly async someMethod()(Not sure if this phrasing makes more sense to people)
andrewbranch commentedon Apr 13, 2021
The order of
overrideandstaticis also not currently enforced.