How do we name a dictionary variable?
Say in my method I have Dictionary<string, List<string>> dictionary;
, where the keys of the dictionary
are country names and the values are lists of province/state names. How should I rename dictionary
?
I know we can create a Country
class for this example. But please don't mention this alternative because I'm thinking of good naming convention here.
Classic C doesn't use camel-case; I've written code in camel-case in C, and it looks weird (so I don't do it like that any more). That said, it isn't wrong - and consistency is more important than which convention is used.
The general practice for a C style language like Java or JS is to use camelCase for all variables and object members (properties & methods), and PascalCase for class names and constructors. Namespaces (or Packages in Java world) are usually in camelCase. But some languages make an exception to that.
All methods and functions should begin with a capital letter. The first letter of each word should also be capitalized. Special characters such as dashes and underscores are prohibited.
Good naming examples include: [Project number] - Data Use Agreement - [Title of research project] Approval - Change to employee travel policy - February 2014.
ProvincesByCountry
I use mostly one of these:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With