codeformatter
codeformatter copied to clipboard
Constants should be PascalCase
Constant fields, eg:
private const int _ShrinkThreshold = 256;
should be PascalCase.
Should constants be prefixed with _ even if they're private? :mask:
At least for corefx, the decision that was reached was that constants would be pascal-cased and not prefixed with an underscore.
I'm basing this on https://github.com/dotnet/corefx/wiki/Coding-style # 12:
12.We use PascalCasing to name all our constant local variables and fields. The only exception is for interop code where the constant value should exactly match the name and value of the code you are calling via interop.
:+1: for @stephentoub's comment
@FiveTimesTheFun Even local variables?
That's from the corefx wiki :) I don't personally disagree with it - that it's constant is more important to me than local vs. field scope.