为什么了StyleCop建议prefixing方法或属性与&QUOT称,这与QUOT;? [英] Why does StyleCop recommend prefixing method or property calls with "this"?

查看:251
本文介绍了为什么了StyleCop建议prefixing方法或属性与&QUOT称,这与QUOT;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在努力遵循的一个项目了StyleCop的指导方针,以查看是否造成code是更好的结局。大多数规则是合理或意见对编码标准的问题,但有一个规则,它让我为难,因为我还没有看到任何人推荐它,因为我没有看到一个明确的好处是:

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 coding standard, but there is one rule which puzzles me, because I haven't seen anyone else recommend it, and because I don't see a clear benefit to it:

SA1101:这个'必须以该调用{方法或属性名称} preFIX以表明产品类中的一员。

在下行中,code显然更详细的方式,那么,什么是下面这条规则的好处是什么?是否有人在这里遵循的规则?

On the downside, the code is clearly more verbose that way, so what are the benefits of following that rule? Does anyone here follow that rule?

推荐答案

它可以使code一目了然清晰。当您使用,它更容易:

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

  • 告诉静态和实例成员分开。 (和区分委托实例方法。)
  • 区分局部变量和参数实例成员(不使用的命名约定)。

这篇关于为什么了StyleCop建议prefixing方法或属性与&QUOT称,这与QUOT;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆