Skip to content
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

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

Merged
merged 6 commits into from
Jul 20, 2021

Conversation

CyrusNajmabadi
Copy link
Member

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.

@@ -3301,7 +3301,7 @@ class D

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
Member 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