I am trying to set up an enum to hold sheet metal gauges (thicknesses). I thought it would be most intuitive if I could write:
using System.ComponentModel;
public enum Gauge
{
[Description("24 Gauge")]
24Ga = 239,
[Description("20 Gauge")]
20Ga = 359,
[Description("18 Gauge")]
18Ga = 478,
[Description("16 Gauge")]
16Ga = 598,
[Description("14 Gauge")]
14Ga = 747
}
but this is rejected by Visual Studio.
Instead this is OK:
using System.ComponentModel;
public enum Gauge
{
[Description("24 Gauge")]
G24 = 239,
[Description("20 Gauge")]
G20 = 359,
[Description("18 Gauge")]
G18 = 478,
[Description("16 Gauge")]
G16 = 598,
[Description("14 Gauge")]
G14 = 747
}
This makes it seem pretty obvious that you are not allowed to start a Enum member name off with a numeric character, even though that is usually allowed for variable names.
My question is: Where is this restriction specified? The Enum Class documentation does not seem to mention it.