Is there any way to give c# enums a “range” of allowed values?
2
Say I have an enum like the following, where I want the numbering to start at 1000. public enum Fruits : uint { Apple = 1000, Orange = 1001, Strawberry = 1002, Banana = 1003, Blueberry = 1004, } Assigning each Fruit a number is tedious and hard to read, not to mention awkward if I have 20+ Fruit s and might want to reorder them or add/remove a Fruit . Is there any kind of syntax like the following? public enum Fruits : uint where value >= 1000 { Apple, Orange, Strawberry, Banana, Blueberry, }
c# enums
share | improve this question
asked Nov 23 '18 at 1:25
...