I am using VS 2012 and Resharper 7. In my project the convention to access private fields is always with "this" qualifier, just to make it clear it's private (e.g. this.myPrivateField). Properties should not be accessed with the this qualifier. We configured resharper and that's working fine. But if I use a quick-fix option, it always puts the this qualifier in front of the used property (e.g. this.MyPublicProperty). Is there any way/setting to turn of that behaviour?
Asked
Active
Viewed 277 times
2
-
1I think you are better off to write to the developers directly. We had in the past a couple of these little issues aswell and they were always very helpful and thankfull for these comments. – dowhilefor Sep 28 '12 at 14:16
-
Your standard is bizarre. `this.` doesn't imply a member is private. It only implies that it's an instance member. That may be why ReSharper has no setting to distinguish between one kind of instance member and another. – John Saunders Sep 28 '12 at 14:47
-
Yeah you are right, but this standard is set by the customer and I just want resharper not to prefix the properties with the this qualifier. Thx for the advice anyway. I will try and contact the developers. – Christian Braun Oct 02 '12 at 09:38
1 Answers
0
You can set the feature to work "For fields in this class", or "For fields", if you're sure to also follow the very standard convention of making all fields private.
Turning on "For fields in this class" allows me to have this code after an automatic cleanup:
public class MyClass
{
private string myPrivateField;
public string MyPublicProperty { get; set; }
public void MyMethod()
{
this.myPrivateField = "Cucumber";
MyPublicProperty = "Cucumber as well";
}
}

J. Steen
- 15,470
- 15
- 56
- 63