Skip to content

Don't combine 'this.' with underscore named fields#54975

Merged
CyrusNajmabadi merged 6 commits intodotnet:mainfrom
CyrusNajmabadi:underscoreField
Jul 20, 2021
Merged

Don't combine 'this.' with underscore named fields#54975
CyrusNajmabadi merged 6 commits intodotnet:mainfrom
CyrusNajmabadi:underscoreField

Conversation

@CyrusNajmabadi
Copy link
Contributor

The point of hte naming is to make it clear that it's a private instance field. So it's redundant to state this. to access it. Note that these cases are the outliers and more than 99% of all field accesses (yes, i checked) do not use this.

@CyrusNajmabadi CyrusNajmabadi requested review from a team as code owners July 20, 2021 16:42
@ghost ghost added the Area-IDE label Jul 20, 2021
@CyrusNajmabadi CyrusNajmabadi enabled auto-merge July 20, 2021 17:09

public D(int _)
{
this._ = _;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this even correct anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, i'll revert the tests.

@CyrusNajmabadi CyrusNajmabadi merged commit cd7b4c7 into dotnet:main Jul 20, 2021
@ghost ghost added this to the Next milestone Jul 20, 2021
@CyrusNajmabadi CyrusNajmabadi deleted the underscoreField branch July 21, 2021 02:50
@allisonchou allisonchou modified the milestones: Next, 17.0.P3 Jul 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants