-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
In visual studio private variables have no _ #30626
Comments
Tagging @CyrusNajmabadi @sharwell to consider if Roslyn can/should change the default naming styles to match conventions. |
hmm - yeah why would Microsoft's Visual Studio not have an option to enforce the naming convention they suggest for their language... without an editor config change... |
Dotnet naming in no way represents the naming for the industry. Last time we looked (admittedly a few years back), camel cased variables was the norm. It wasn't even close. Personally, I think dotnet naming is super silly and literally how against our guidance around unnecessary sigils on identifiers. So I find it unlikely we would change here for this niche audience. If you want this naming convention, just specify it. |
This is an area we should look at more holistically. In general, our docs follow the dotnet/runtime coding style. We should update these articles to match that, and point liberally to the editorconfig section of the Visual Studio docs to enable each team to enforce their preferences. |
Actually my preferred solution is for Microsoft to drop their silly 2021 decision to bring in all the _ s_ t_ dotnet stuff, but bit late now! I don't want to use it, but many teams will want to follow the documented style. |
Also, i have no issue with us shipping some sort of '.net naming' style that people could choose. Or an easy way to add all the right naming styles to an existing editorconfig. I would just push back on any sort of step that made this the default for everyone if they moved to a new version of VS. This needs to be something people can opt-into, not something they're forced into that they need to opt-out of. Thanks! |
Fixes dotnet#30626: Clarify (again) that these are our guidelines, not yours. Point out that it's not the VS default, but a configuration option. Fixes dotnet#30642: Again, our style. Fixes dotnet#30799: Change constant style from ALL_CAPS to PascalCase to match runtime repo. Fixes dotnet#33959: Update variable names so delegate types are PascalCased and instances of a delegate are camelCase. Add clarifying text for the same.
* rearrange content Make the new content organization follow better ordering. * rewrite and update Rewrite to match the docs team's accepted style. * Edits to fix `var` issues Fixes #26787: clarify "obvious" Fixes #32633: add explanation, update variable names. Fixes #34940: Explain that `var` is preferred in LINQ queries, despite other rules. * Fix naming conventions Fixes #30626: Clarify (again) that these are our guidelines, not yours. Point out that it's not the VS default, but a configuration option. Fixes #30642: Again, our style. Fixes #30799: Change constant style from ALL_CAPS to PascalCase to match runtime repo. Fixes #33959: Update variable names so delegate types are PascalCased and instances of a delegate are camelCase. Add clarifying text for the same. * Fix exception example Fixes #31951 : Rewrite the exception example so that it's still obvious what can fail, but couldn't be easily anticipated before making the computation. * Fixes #30897 Move the Generic type parameter naming conventions to the general naming conventions. * Fix build warnings * Reference runtime convention The use of `_` and `s_` follow the runtime conventions. I'd missed that in the previous commit. * Apply suggestions from code review Co-authored-by: David Pine <[email protected]> --------- Co-authored-by: David Pine <[email protected]>
You say here about using underscore on private and internal members (despite some dispute over the history of this).
Yet Visual Studio Community 2022 will not put an _ on private variables by default and converting an auto property to a full one with private member will simply use a lower case private variable as one would expect, but contrary to the tips here.
Is there a disconnect between Visual Studio team and the docs team here?
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Associated WorkItem - 123086
The text was updated successfully, but these errors were encountered: