-
Notifications
You must be signed in to change notification settings - Fork 25.3k
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
Fix naming violations in sample code (_camelCase with underscore for private fields) #30533
Comments
Hello @hakenr ... We go by the ASP.NET Core engineering guidelines without underscores, except that we use the |
Conventions are generally non-binding guidelines intended to enhance readability and ensure a consistent experience. Previously, there was no explicit naming convention for Users who frequent learn.microsoft.com often don't differentiate between various sections of the documentation. As such, I believe the same naming conventions should apply across all sections, unless otherwise specified. (In my team, we've been using the non-underscore convention for private fields for years. With the new guidelines now available in the official documentation, we've decided to align ourselves with the mainstream and modify our practices accordingly.) |
Sure ... I understand. They may have decided to take a harder stand on it. Still tho, I'm just a small green dinosaur 🦖 in a BIG Microsoft world. Management will let me know what they'd like to do ... AND they need to take care of the Blazor project templates for the change if they go with underscores. That will require an issue over on their repo. I wouldn't necessarily open it now tho. I'm composing an internal message to them now on this, and I can report back here (or they'll pop in here and let us know) shortly. Stand-by .................. UPDATE ... Ok ... Message sent! We should hear back soon. UPDATE (10/2) ... Word back is that they'll discuss it and get back to us. |
The coding guidelines referenced are actually specific to the dotnet/docs and dotnet/runtime repos as described here: https://learn.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions. While we follow many of these same guidelines in the dotnet/aspnetcore.docs repo, we diverge in some places to keep our samples and snippets consistent with the default behavior of Visual Studio and our shipped templates. |
(The funny part: The https://github.com/dotnet/aspnetcore repo follows |
AFAIK, there's a technical reason in framework development for doing it in framework code. Ryan and Pranav (before they left) didn't elaborate, but that's what they told me. Ryan said one of my favorite PU quotes ever on this subject: He said whether or not to guide community/customer devs to I think what I'm going to do is remark on this in the Blazor section that pertains to how we present Blazor doc code to readers. I'll make a tracking note so that I don't forget. |
The "new" official naming rules and conventions for C# identifiers require using
_camelCase
for private instance fields.Blazor section of the documentation (especially in
@code
sections) does not comply with this standard.E.g.
Should be
Please confirm the "new" convention is expected to be used in Blazor or create a Blazor-specific sub-convention.
If you confirm the convention for Blazor, I can create a PR fixing all the occurences in the doc.
Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.
The text was updated successfully, but these errors were encountered: