The guidelines are clear for enumerations...
Do use a singular name for an enumeration, unless its values are bit fields.
(Source: http://msdn.microsoft.com/en-us/library/ms229040.aspx)
...but not so clear for a class of constants (or read-only static fields/propertes). For example, should the name of this class be singular or plural?
public static class Token // or Tokens?
{
public const string Foo = "Foo";
public const string Bar = "Bar";
public const string Doo = "Doo";
public const string Hicky = "Hicky";
}
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!)