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
Missing an option between "Prefer var for built-in types" and "when variable type is apparent" #23714
Comments
This is by design. The rules are applied in the following order:
As soon as an applicable case is encountered from this list, the remaining items are ignored. |
I'm asking for this behavior to be revisited |
I don't care how this is designed, but it is odd to me that with in-built types you can't have a "use var when type is apparent" behavior. |
Tentatively marked By Design since the current behavior was not unintentional; will update with discussion outcome following design review. |
@sharwell Note that you mentioned this will go to the next design meeteing and will be updated with the results. However, the results (if this happened) were not posted to the issue. can you update accordingly? Thanks! |
@sharwell Could you please share a logic behind current design? I cannot really imagine any case where user would want to use var for apparent types except for apparent built-in types. That means logic like this: |
It's common for StyleCop users. Even if we ended up with people generally agreeing that either order works, the types in question here are very common and any change would require many teams to make large numbers of changes to their code to fix the new warnings. |
There doesn't seem a combination of var options that allows the following:
but disallows the following:
In my opinion, the former should fall under "when variable type is apparent".
The text was updated successfully, but these errors were encountered: