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?
if (b) x(); else y();
vsif (b) { x(); } else { y(); }
)?"}
of aclass
,interface
,enum
, orstruct
), I would prefer an extra comma after the last member inside you enum. That is, I would prefer to end with... Sunday, }
. So my personal preference is: Skip optional semicolons, include all optional commas.