摘要:I found this tip in an incidental and quick Rebuild when I suddenly notice the extra comma but compiler didn't report any error before I could be able to abort it! I thought it were a nice and kind bug in C# compiler but it's NOT, as shown in C# Language Specification 12.6 (array initializers), 14.1 (enum declarations), 17.2 (attribute specification)!
As in the following examples:
object[] x = new object[] {a, b, c,}
and:
[Obsolete, Flags,]public enum Y{ A, B, C,}
which allows you to easily reorder the declaration list by using ^L...^V or Shift-Alt-T in VS.NET:
[Obsolete, Flags,]public enum......[
阅读全文]