C# Enums with Flags Attribute
I was wondering if Enums with Flag attribute are mostly used for Bitwise operations why not the compilers autogenerate the values if the enum values as not defined. For eg. [Flags] public enum MyColor { Yellow = 1, Green = 2, Red = 4, Blue = 8 } It would be helpful if the values 1,2,4,8 are autogenerated if they are not assigned. Would like to know your thoughts on this. This is a little easier: [Flags] public enum MyColor { Yellow = 1<<0, Green = 1<<1, Red = 1<<2, Blue = 1<<3 } They probably could, but with a compiler of this size they have to take into consideration the time and resources