The naming convention for constants in C# is Pascal casing:
private const int TheAnswer = 42;
But sometimes we need to represent already-existing constants from the Windows API.
For example, I don't know how to name this:
/// <summary>
/// With this style turned on for your form,
/// Windows double-buffers the form and all its child controls.
/// </summary>
public const int WS_EX_COMPOSITED = 0x02000000;
What should I name it?
Keeping it as WS_EX_COMPOSITED
allows me to quickly associate it with the WinAPI, but it's wrong.
Some options:
WsExComposited
-- Too hungarianComposited
-- Too shortWsEx
enum withComposited
in it -- Still hungarianExtendedWindowsStyles.Composited
-- Constant in a class? Enum?
It should be noted that the objectives for a good naming are:
- It must be readable.
- It must not trigger FxCop and StyleCop, even if that means hiding it from them.