ReSharper的抱怨大写" ID"在成员和QUOT; ENTITYID" [英] ReSharper complains about uppercase "ID" in member "EntityID"

查看:613
本文介绍了ReSharper的抱怨大写" ID"在成员和QUOT; ENTITYID"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个类的属性ENTITYID。 ReSharper的(5.1)说:

I have a property "EntityID" in a class. Resharper (5.1) says

名称'ENTITYID不符合规则
'的方法,属性和事件。
建议的名称是'ENTITYID

Name 'EntityID' does not match rule 'Methods, properties and events'. Suggested name is 'EntityId'.

不过,恕我直言,根据在的Design准则类库开发。 ENTITYID'应该是完美的罚款:

But IMHO according to the naming conventions in the Design Guidelines for Class Library Developers. 'EntityID' should be perfectly fine:


  • 请不要使用未普遍接受的计算$缩写b $ b场。

  • 在适当的地方,使用众所周知的缩写来代替冗长的短语
    的名字。例如,使用的用户界面为用户
    接口和OLAP为在线
    分析处理。

  • 当使用首字母缩写词,使用Pascal大小写或骆驼案例缩写超过
    两个字符长。例如,使用
    HtmlButton或htmlButton。但是,
    应该利用首字母缩写词是
    只包含两个字符,例如
    作为System.IO,而不是System.Io的。

  • 请不要使用在缩写标识符或参数名称。如果你
    必须使用缩写,使用骆驼情况下
    对于包含多个
    超过两个字符缩写,即使这
    违背了单词的标准缩写

  • Do not use acronyms that are not generally accepted in the computing field.
  • Where appropriate, use well-known acronyms to replace lengthy phrase names. For example, use UI for User Interface and OLAP for On-line Analytical Processing.
  • When using acronyms, use Pascal case or camel case for acronyms more than two characters long. For example, use HtmlButton or htmlButton. However, you should capitalize acronyms that consist of only two characters, such as System.IO instead of System.Io.
  • Do not use abbreviations in identifiers or parameter names. If you must use abbreviations, use camel case for abbreviations that consist of more than two characters, even if this contradicts the standard abbreviation of the word

*的更新:* 的准则还最新版本说:

*Update: * The latest version of the guidelines also say:

不要利用两个字符缩写的两个角色,除骆驼套管标识符的
第一个字。

命名DBRate属性是一个短的缩写的例子(DB)使用
作为一个Pascal-套管
标识的第一个字。一个参数命名为
ioChannel是作为
A骆驼套管标识的第一个字短
的缩写(IO)的例子。

Do capitalize both characters of two-character acronyms, except the first word of a camel-cased identifier. A property named DBRate is an example of a short acronym (DB) used as the first word of a Pascal-cased identifier. A parameter named ioChannel is an example of a short acronym (IO) used as the first word of a camel-cased identifier.

我是否理解正确的指引?如果是这样,我怎么可以让ReSharper的接受ENTITYID(众所周知的两个字母的缩写),但拒绝HTMLReader的(应该是HTMLReader的)。

Am I understanding the guidelines correctly? If so, how can I make ReSharper accept "EntityID" (well known two letter acronym) but reject "HTMLReader" (it should be HtmlReader).

推荐答案

你要坚持到框架设计指南的建议,或者你想使用大写 ID 不管?

Do you want to stick to the recommendations of the Framework Design Guidelines, or do you want to use uppercase ID regardless?

的有这么一段准则版本:

The latest version of the guidelines has this to say:

这可以用于
在标识符这两个缩写是 ID 确定。在
帕斯卡尔 - 套管标识符应该
显示为编号确定。如果用作
在骆驼套管
标识的第一个字,就应该显示为 ID
确定,分别为。

The two abbreviations that can be used in identifiers are ID and OK. In Pascal-cased identifiers they should appear as Id, and Ok. If used as the first word in a camel-cased identifier, they should appear as id and ok, respectively.

所以看起来ReSharper的是在的情况下,正确的编号

So it seems that ReSharper is correct in the case of Id.

出于兴趣,ReSharper的还建议两个字符的缩写遵循相同的大小写规则。这是在与准则赔率:,不要利用两个字符缩写的两个角色,除骆驼套管标识的第一个字

Out of interest, ReSharper also recommends that two character acronyms follow the same casing rules. This is at odds with the guidelines: "Do capitalize both characters of two-character acronyms, except the first word of a camel-cased identifier."

这篇关于ReSharper的抱怨大写" ID"在成员和QUOT; ENTITYID"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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