C# 中的枚举类型⽀持哪些特性和功能?
enum DaysOfWeek{Sunday, // 默认值为 0Monday, // 默认值为 1Tuesday,Wednesday,Thursday,Friday,Saturday}
enum DaysOfWeek{Sunday, // 默认值为 0Monday, // 默认值为 1Tuesday,Wednesday,Thursday,Friday,Saturday}
EnumName:枚举的名称,通常采用 Pascal 大小写命名规则。BaseType(可选):指定枚举的基础类型(默认是 int),可以是任何整型类型(如 byte, short, long等)。Value:枚举中的命名常量。
enum DaysOfWeek{Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday}class Program{static void Main{DaysOfWeek today = DaysOfW