C# StyleCop - Using “this.” prefix for base class members like current class members or not?
- 阅读更多 关于 C# StyleCop - Using “this.” prefix for base class members like current class members or not?
问题 StyleCop has a rule about using "this." prefix to calling class members (SA1101). Is this rule holds true about a member (for example a method) of a class which is inherited from its base class. Example: class BaseClass { protected void F1() { ... } } class ChildClass : BaseClass { protected void F2() { ... } protected void F3() { this.F2(); // This is correct acording to SA1101 // F1 is a member of base class and if I dont put this prefix, stylecop will not show any message. this.F1(); // Is