-
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
Update coding guidelines #36428
Merged
Merged
Update coding guidelines #36428
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Make the new content organization follow better ordering.
Rewrite to match the docs team's accepted style.
Fixes dotnet#26787: clarify "obvious" Fixes dotnet#32633: add explanation, update variable names. Fixes dotnet#34940: Explain that `var` is preferred in LINQ queries, despite other rules.
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.
Fixes dotnet#31951 : Rewrite the exception example so that it's still obvious what can fail, but couldn't be easily anticipated before making the computation.
Move the Generic type parameter naming conventions to the general naming conventions.
The use of `_` and `s_` follow the runtime conventions. I'd missed that in the previous commit.
IEvangelist
approved these changes
Jul 28, 2023
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.
Just a few nits, otherwise this looks great!
docs/csharp/fundamentals/coding-style/snippets/coding-conventions/program.cs
Outdated
Show resolved
Hide resolved
docs/csharp/fundamentals/coding-style/snippets/coding-conventions/program.cs
Outdated
Show resolved
Hide resolved
docs/csharp/fundamentals/coding-style/snippets/coding-conventions/program.cs
Outdated
Show resolved
Hide resolved
docs/csharp/fundamentals/coding-style/snippets/coding-conventions/program.cs
Outdated
Show resolved
Hide resolved
docs/csharp/fundamentals/coding-style/snippets/coding-conventions/program.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: David Pine <david.pine@microsoft.com>
BillWagner
added a commit
to BillWagner/docs
that referenced
this pull request
Jul 31, 2023
See dotnet#36428 (comment) For the issue involved, it's a better fix to create local variables for the Func and Action objects. That shows readers the distinction between the delegate type and the instance.
BillWagner
added a commit
that referenced
this pull request
Jul 31, 2023
See #36428 (comment) For the issue involved, it's a better fix to create local variables for the Func and Action objects. That shows readers the distinction between the delegate type and the instance.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There are a number of issues related to our coding standards used in .NET docs.
Many of the issues arise because readers conflate our style with Microsoft recommended style. The first commits made that distinction much more clear.
This may be easier to review commit-by-commit:
var
:var
is preferred in LINQ queries, despite other rules.Internal previews