-
-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
order modifiers #744
order modifiers #744
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, I took a quick look at the test files and yeah I'm not a super big fan of putting async
before public
.
Would very much prefer if you sorted them in the order you listed (as per style rule IDE00036).
The other part of this is figuring out how to get |
Is this forgotten? I just ran into this issue, and would love to see it implemented. |
|
||
public int Compare(string? x, string? y) | ||
{ | ||
int GetIndex(string? value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this a nested method?
I feel like it could be a private static method in that class.
{ | ||
int GetIndex(string? value) | ||
{ | ||
var result = Array.IndexOf(DefaultOrdered, value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, this gets called for every comparison of every declaration in the source code, right?
It might be worth optimizing to be constant time access by say, initializing a static dictionary of string to index.
#if !SILVERLIGHT | ||
unsafe | ||
#endif | ||
static String Method() { } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Damn, how did you even come up with this case 😲
an attempt to fix #725
I believe now comes the "opinionated" part, I could implement this order default value (which I found after this quick implementation):
public, private, protected, internal, file, static, extern, new, virtual, abstract, sealed, override, readonly, unsafe, required, volatile, async
from:
https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0036