Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I order the enum values in intellisense?

Tags:

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 
like image 628
TheSean Avatar asked Jun 05 '09 12:06

TheSean


People also ask

Do enums have to be sequential?

There is nothing that requires them to be sequential. Your enum definition is fine and will compile without issue.

Should enums be numbers?

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.

Can enum have more than one value C#?

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.

Can we add new enumeration value by runtime?

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.


1 Answers

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.

like image 111
bobbyalex Avatar answered Oct 28 '22 16:10

bobbyalex