-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Blazor access modifiers and field underscores #18446
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
Conversation
BTW - whether or not we're doing That doesn't sound like me, I'm part of #ThisSquad 😁 |
Mentioning the guideline for discussion only in case anyone else sees this. I know that ur aware of the lingo 😄 ...
I performed a doc sample search to see how common |
@guardrex we spoke about this offline, and the decision was to land close to what VS does by default which is to use |
I can update this ... I think the rest of the goodies on here are ok. I'll take care of it |
@pranavkm ... Had a minute while 🍗 was cook'in. 👨🍳 Updated! |
@@ -38,14 +38,14 @@ else | |||
} | |||
|
|||
@code { | |||
private WeatherForecast[] forecasts; | |||
private WeatherForecast[] _forecasts; |
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.
The ones above I'm 😐 about since they're sample. However, going by my discussion, we would use this.
to disambiguate locals versus global, and not prefix items with underscores.
Nevermind my last remark here. I'm rambling a bit. Let's close this. If a docs issue is opened to conform doc examples/samples to different coding style than the one we have, lay out the rules for me in the new docs issue. I'll go through and conform everything to the guidance. Currently, the docs follow this pattern:
The docs are internally consistent. The only discrepancy is between what devs see in a template-generated app and the docs. That's where I think devs might become confused 😵. |
For Blazor templates per dotnet/AspNetCore.Docs#15853 (comment) ...
[Parameter]
on its own line.Summaries
, aprivate static readonly string[]
field, is named like a constant (capitalized). If that's by-design, I'll revert.I swap in an underscored field forReverted!this.logger = logger
inWeatherForecastController.cs
. I thoughtthis
was "banished to the land of wind and ghosts (-RN)." If by-design, I'll revert.