您应该使用价格表。 标准命名约定要求类名和属性采用帕斯卡大小写。 由于字典将短语 price list 列为两个单词,因此第二个单词应使用 Pascal 大小写大写。
You should use PriceList. Standard naming conventions call for Pascal case for class names and properties. Since the dictionary lists the phrase price list as two words, the second word should be capitalized using Pascal casing.
Like FxCop it depends on your intention. IF you have an object that represents a Pricelist, which perhaps has a Title and an issue date and then contains a list of items which carry a name and price then Pricelist seems correct.
OTH if you have an object of type List<Price> then PriceList (or Prices) would be better.
Its important not too get hung up on obeying the rules and miss the principle involved. In this case its an entirely human issue (as far as the compiler is concerned it could be called Pinkelephants, pinkElephants or PinkElephants, it doesn't care). In which case you should pick whatever feels the most natural or normal.
However if it is a List then “PriceList” (or Prices) would be better, as it makes it clears it is two concepts joined together. But if you have a class called “Pricelist” (maybe with a Title and an issue date) and/or Pricelist is a concept that is in your problem domain, I would tend to use “Pricelist”
In the end it does not matter as both are easy to understand and read, it would be best if witch ever you choose was used throughout the system.
The standard FxCop rules tends to gives lots of output, only some of witch is helpful. If you are working on a big system, you may wish to write a custom FxCop rule to enforce witch ever one of "PriceList" or "Pricelist" you choose in use in this system.
发布评论
评论(4)
您应该使用价格表。 标准命名约定要求类名和属性采用帕斯卡大小写。 由于字典将短语
price list
列为两个单词,因此第二个单词应使用 Pascal 大小写大写。You should use PriceList. Standard naming conventions call for Pascal case for class names and properties. Since the dictionary lists the phrase
price list
as two words, the second word should be capitalized using Pascal casing.就像 FxCop 一样,这取决于您的意图。 如果您有一个代表价格表的对象,该对象可能具有标题和发布日期,然后包含带有名称和价格的项目列表,那么价格表似乎是正确的。
另外,如果您有一个
List
类型的对象,那么 PriceList(或Price)会更好。重要的是不要过于沉迷于遵守规则而忽视所涉及的原则。 在这种情况下,这完全是人为问题(就编译器而言,它可以被称为 Pinkelephants、pinkElephants 或 PinkElephants,它并不关心)。 在这种情况下,您应该选择感觉最自然或最正常的东西。
Like FxCop it depends on your intention. IF you have an object that represents a Pricelist, which perhaps has a Title and an issue date and then contains a list of items which carry a name and price then Pricelist seems correct.
OTH if you have an object of type
List<Price>
then PriceList (or Prices) would be better.Its important not too get hung up on obeying the rules and miss the principle involved. In this case its an entirely human issue (as far as the compiler is concerned it could be called Pinkelephants, pinkElephants or PinkElephants, it doesn't care). In which case you should pick whatever feels the most natural or normal.
价格表在韦氏词典或牛津词典中均不作为独立术语存在。 FxCop一定是在编造词。
Pricelist does not exist as a discrete term in either Merriam Webster or Oxford. FxCop must be making up words.
“PriceList”和“Pricelist”都可以。
然而,如果它是一个列表,那么“PriceList”(或价格)会更好,因为它清楚地表明这是两个结合在一起的概念。 但是,如果您有一个名为“Pricelist”的类(可能带有标题和发布日期)和/或Pricelist是您的问题域中的一个概念,我会倾向于使用“Pricelist”
最终它并不重要,因为两者都很容易理解和阅读,如果您选择的任何一个都在整个系统中使用,那就最好了。
标准 FxCop 规则往往会提供大量输出,只有一些女巫是有帮助的。 如果您正在使用大型系统,您可能希望编写自定义 FxCop 规则来强制执行您选择在此系统中使用的“PriceList”或“Pricelist”之一。
Both "PriceList" and "Pricelist" are ok.
However if it is a List then “PriceList” (or Prices) would be better, as it makes it clears it is two concepts joined together. But if you have a class called “Pricelist” (maybe with a Title and an issue date) and/or Pricelist is a concept that is in your problem domain, I would tend to use “Pricelist”
In the end it does not matter as both are easy to understand and read, it would be best if witch ever you choose was used throughout the system.
The standard FxCop rules tends to gives lots of output, only some of witch is helpful. If you are working on a big system, you may wish to write a custom FxCop rule to enforce witch ever one of "PriceList" or "Pricelist" you choose in use in this system.