我可以在intellisense中订购枚举值吗?

时间:2021-04-11 10:00:24

I have an eum type with 5 members. Is it possible to tell intellisense to order them the way I want?

我有一个有5名成员的eum类型。有可能告诉intellisense以我想要的方式订购它们吗?

public enum numbers
{
    zero,
    one,
    two,
    three,
    four
}

Intelisense shows (in alpha):

Intelisense显示(在alpha中):

four
one
three
two
zero

4 个解决方案

#1


11  

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.

不,你不能。但Visual Studio团队已经考虑了这个建议,即使不完全按照你想要的方式。但是,嘿,这是一个开始。

See the Microsoft connect response here http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=419602

请参阅此处的Microsoft连接响应http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=419602

I have added your requirement as a comment on the site.

我已将您的要求添加为对网站的评论。

#2


9  

I think the only way to do that would be to do something like

我认为这样做的唯一方法就是做类似的事情

public enum numbers
{
    num_00,
    num_01,
    num_02,
    num_03,
    num_04
}

#3


8  

No you can't as far as I know. Intellisense orders them alphabetically.

不,据我所知你不能。 Intellisense按字母顺序排序。

#4


3  

well if you use this kind of declaration for enum intellisense will sort by the first character

好吧,如果你使用这种声明enum intellisense将按第一个字符排序

by diffrewnt kind of declartion i mean you can start the enum like _0 _1 _2 like that where _ will have the same previlage and then 0 1 2 etc will be used to reorder it.

通过diffrewnt类型的声明我的意思是你可以像_0 _1 _2那样启动枚举,就像_将具有相同的previlage然后0 1 2等将用于重新排序它。

#1


11  

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.

不,你不能。但Visual Studio团队已经考虑了这个建议,即使不完全按照你想要的方式。但是,嘿,这是一个开始。

See the Microsoft connect response here http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=419602

请参阅此处的Microsoft连接响应http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=419602

I have added your requirement as a comment on the site.

我已将您的要求添加为对网站的评论。

#2


9  

I think the only way to do that would be to do something like

我认为这样做的唯一方法就是做类似的事情

public enum numbers
{
    num_00,
    num_01,
    num_02,
    num_03,
    num_04
}

#3


8  

No you can't as far as I know. Intellisense orders them alphabetically.

不,据我所知你不能。 Intellisense按字母顺序排序。

#4


3  

well if you use this kind of declaration for enum intellisense will sort by the first character

好吧,如果你使用这种声明enum intellisense将按第一个字符排序

by diffrewnt kind of declartion i mean you can start the enum like _0 _1 _2 like that where _ will have the same previlage and then 0 1 2 etc will be used to reorder it.

通过diffrewnt类型的声明我的意思是你可以像_0 _1 _2那样启动枚举,就像_将具有相同的previlage然后0 1 2等将用于重新排序它。