Possible Duplicate:
.NET Enumeration allows com开发者_JAVA技巧ma in the last field
public enum SubPackageBackupModes
{
Required,
NotRequired //no comma
}
public enum SubPackageBackupModes
{
Required,
NotRequired, //extra unnecessary comma
}
Since both compile, is there any differences between these declarations?
I prefer second syntax because if you will add addition member to your enum you will have only one line difference in SCM.
No, there is no difference.
This was allowed in C++ also, and that continues. I guess it is easier with the comma, since you may comment out the last enum element and it is easier for code-generation tools.
精彩评论