Should C# enums end with a semi-colon?
.net, c#, enums
Solution
From the C# specification (via archive.org):
14.1 Enum declarations
An enum declaration declares a new enum type. An enum declaration begins with the keyword enum, and defines the name, accessibility, underlying type, and members of the enum.
- attributes opt
- enum-modifiers opt
- enum identifier
- enum-base opt
- enum-body
- ; opt
So a single semicolon at the end is allowed but optional.
Problem
In C#, it appears that defining an enum works with or without a semi-colon at the end: ``` public enum DaysOfWeek { Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday} ; //Optional Semicolon? ``` This C# page from MSDN shows enums ending with semicolons, except for the `CarOptions`. I haven't found any definitive reference, and both ways appear to work without compiler warnings. So should there be a final semicolon or not?