Search code examples
.netnaming-conventionsnamingcode-analysisfxcop

Naming: Pricelist vs. PriceList


Which is more correct, "PriceList" or "Pricelist"?

FxCop says: CA1702 : Microsoft.Naming : The compound word 'PriceList' in type name 'PriceList' exists as a discrete term. If your usage is intended to be single word, case it as 'Pricelist'.

Edit: This is an object with Title, Start/End date etc.


Solution

  • 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.