Why does StyleCop recommend prefixing method or property calls with “this”?

前端 未结 9 2104
孤街浪徒
孤街浪徒 2020-11-27 04:15

I have been trying to follow StyleCop\'s guidelines on a project, to see if the resulting code was better in the end. Most rules are reasonable or a matter of opinion on cod

9条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-27 04:24

    It can make code clearer at a glance. When you use this, it's easier to:

    • Tell static and instance members apart. (And distinguish instance methods from delegates.)
    • Distinguish instance members from local variables and parameters (without using a naming convention).

提交回复
热议问题