I use a custom set of rules in StyleCop along with it’s ReSharper plugin to automatically check my code as I type.
The rule SA1101 in StyleCop states that calls to members of the current class need to begin with this. to indicate that it is in-fact defined in the current class.
Is there a way to set it up so when I go to auto-complete a member of the class, it automatically adds in the this. prefix, so I don’t have to remember how to type it or add it afterwards?
Lets use public bool Running { get; set; } as an example:
I type “Run” + Tab, and right now it comes out to Running, but I would like it to come out as this.Running.
This would save a-lot of time and typing.
EDIT
Please note that the option ReSharper => Options => Code Editing => C# => Formatting Style => Other => "Force 'this.' qualifier for instance member" (as mentioned by Jon) in resharper does not work as intended. Neither when adding a ; at the end of the statement (which would be acceptable), or after the tab is this. being added to the class member.
If you go to
there is an option called “Force ‘this.’ qualifier for instance member”.
Enabling it should work as you intend.