Naming convention for class of constants in C#: plural or singular?

I would use the plural: Tokens. This implies that the static class is serving as a collection of items of some sort (whose runtime types are not that of the class).

On the other hand, an enumeration’s fields are instances of the enumeration type. For example, TypeCode.String is a TypeCode. It would be weird to say that TypeCodes.String is a TypeCodes.

However, in your Tokens example, using the singular gives us Token.Foo, which is a token, but it is not a Token (it is a string).

(Or, if you use the plural class name, Tokens.Foo is a string, not a Tokens. Ack!)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)