On my current project I have to call all non static methods with the this.
prefix.
For example:
public void Test(){
//wrong call
DoIt();
//Right call
this.DoIt();
}
public void DoIt(){
return "yeah";
}
Now R# says (and it is right) that when I type this.
, it is a redundant qualifier.
So I switched of that rule, but I want to go one step further: can I create a rule in R# (or VS2013) itself to give me a warning when I don't use this.
in calling non-static methods?
You could use https://stylecop.codeplex.com/, which checks this and many other formatting issues. It can be somewhat anal sometimes, so it might be a good idea to disable certain rules like spellchecking (the dictionary is limited and adding words is costing a lot of time) and hungarian notation checking (I feel every second variable is hungarian for stylecop....)
Additionally, I would recommend to use special comments like autogenerated to turn off stylecop for code generated by tools (like entity framework code first migrations)
http://shishkin.wordpress.com/2008/07/08/stylecop-how-to-ignore-generated-code/