使用 VB.NET 的 Visual Studio 2010 中枚举类型的 Intellisense 发生了什么?
我正在使用 Visual Studio 2010 Prof。
在 C# 中,我可以创建自己的枚举器并按如下方式使用它:
MyEnum value =
现在,Intellisense 将建议 MyEnum 的值。
在 VB 中,当我写:
Dim value As MyEnum =
我得到了每种类型的巨大列表。当开始编写我的枚举值(可能是“sunny”之类的单词)时,它会过滤掉某些类型,但我希望像 C# 中那样拥有它。无论如何,我将使用 MyEnum 类型,而不使用“String、Objecte 或 IntPtr...”。
有什么想法吗?
我还制作了一个短视频: 带有示例的视频(新)
问候
I am using Visual Studio 2010 Prof.
In C# I can create my own Enumerator and use it like this:
MyEnum value =
Now, Intellisense will suggest a value of MyEnum.
In VB, when I write:
Dim value As MyEnum =
I get a huge list of every types. When starting to write my enumerator value (could be a word like "sunny") it filters out some types but I would like to have it like in C#. Anyway I will use the MyEnum type and no "String nor Objecte nor IntPtr...".
Any idea?
Also I made a short video:
Video with sample (new)
Regards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
很简单,您所要做的就是单击 Intellisense 下拉列表底部的“常用” 选项卡。
为了证明这一点,下面是我在 VS 2010 中输入
=
后立即看到的屏幕截图:但是,即使您选择了“全部”选项卡,枚举中定义的值仍然会首先自动显示,甚至会分组在一起。您确实会看到所有可能的成员和类型,甚至是那些完全不相关的成员和类型,但仍然很容易找到您想要的成员和类型。
不,我没有使用任何第三方加载项或扩展来实现所演示的壮举。据我所知,我也没有从默认设置中重新配置任何相关选项。
Simple, all you have to do is click the "Common" tab at the bottom of the Intellisense drop-down.
To prove it, here's a screenshot of what I see in VS 2010, immediately after typing
=
:But, even if you have the "All" tab selected, the values defined in the enum will still be automatically displayed first, and even appear grouped together. You will indeed see all possible members and types, even those that are completely unrelated, but it's still pretty easy to find the ones you want.
And no, I'm not using any third-party add-ins or extensions to achieve the demonstrated feat. As best I can tell, I also haven't reconfigured any relevant options from the default settings.
这是 VS 2010 SP1 之前版本中记录的问题。请参阅:https://connect.microsoft.com/VisualStudio/feedback /details/551699/intellisense-enum-values。它已在 SP1 中修复。如果无法安装 SP1,唯一的解决方法是使用鼠标或 Alt + , 进行切换从“全部”选项卡到“常用”选项卡。
This is a documented issue in VS 2010, pre-SP1. See: https://connect.microsoft.com/VisualStudio/feedback/details/551699/intellisense-enum-values. It has been fixed in SP1. If you can't install SP1, the only workaround is to use the mouse or Alt + , to switch from the "All" to the "Common" tab.