Possible Duplicate:
C# naming convention for constants?
I'm refactoring a library in C# and I found a lot of upper case constants:
INTERVAL, TIME, SECONDS.
I think this a kind of unnecessary, and personally I prefer declare everything with camel case. Exist some exactly definition about the better way?
Ultimately the case isn't going to make any difference (unless it collides with a type/keyword/etc). So really consistency is the main thing.
The Capitalization Conventions don't distinguish between constants and other members - but these are guidelines only. So it would be pascal-case.
All-caps constants are a common convention…
…but a convention is just that, and is arbitrary. If you are writing code for yourself, there is no compelling reason not to choose your own. If you work with other developers, you must all agree on a naming convention.
If you are writing something that will be consumed by others outside your team, you might do well to stick to the most common and recognizable naming conventions to avoid confusion.
In the end, consistency is what counts.
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