Questions tagged «enum-flags»


6
为什么通常用十六进制值定义标志枚举
很多时候,我看到使用十六进制值的标志枚举声明。例如: [Flags] public enum MyEnum { None = 0x0, Flag1 = 0x1, Flag2 = 0x2, Flag3 = 0x4, Flag4 = 0x8, Flag5 = 0x10 } 当我声明一个枚举时,通常会这样声明: [Flags] public enum MyEnum { None = 0, Flag1 = 1, Flag2 = 2, Flag3 = 4, Flag4 = 8, Flag5 = 16 } …
121 c#  .net  enums  enum-flags 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.