I have an eum type with 5 members. Is it possible to tell intellisense to order them the way I want?
public enum numbers { zero, one, two, three, four }
Intelisense shows (in alpha):
four one three two zero
There is nothing that requires them to be sequential. Your enum definition is fine and will compile without issue.
Enums are always assigned numeric values when they are stored. The first value always takes the numeric value of 0, while the other values in the enum are incremented by 1.
Simple Enum - The members of this enum contain a single value. Flags Enum - The members of this enum contain multiple values or multiple values combined using a bitwise OR operator. These enums are often used for bitwise operators.
Answers. The only way to add values to a enum is to recompile the application. Even then, the application must have code to handle those enums.
No you cant. But the Visual Studio team has considered the suggestion even though not exactly the way you would want it. But hey, its a start.
You can vote on the link @sepster provided:
https://developercommunity2.visualstudio.com/t/Intellisense-display-enums-by-numeric-or/871057?space=8&entry=suggestion
Edit: Microsoft connect has been retired. Leaving this here for future reference.
See the Microsoft connect response here http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=419602
I have added your requirement as a comment on the site.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With