VS2010 Code Intellisense Improvements(VS2010代码智能提示的改进)
2009-10-30 11:39
274 查看
This archive is from scott's blog http://weblogs.asp.net/scottgu
To help illustrate this intellisense improvements coming with VS 2010, let’s start by doing a simple scenario in VS 2008 where we want to write some code to enable an editing scenario with a GridView control.
Code Intellisense with VS 2008
We might start off by typing “GridView1.Edit” to bring up intellisense to see what Edit members are available on the control. Doing this with VS 2008 brings up the intellisense drop-down and filters the current location in the dropdown to the members that start with the word “Edit”:
This is great if the method/property/event we want to work with starts with “Edit” – but doesn’t really help us if the “Edit” member we are looking for starts with something else (for example: the “RowEditing” event or the “SetEditRow()” helper method). We have to either manually scroll up and down looking for the other edit members, or pull up the object browser or help system to find them.
Code Intellisense with VS 2010
Let’s now try out the same scenario with VS 2010. When we type “GridView1.Edit” within VS 2010 we’ll find that the EditIndex property is still highlighted by default. But the intellisense list has also been filtered so that it enables you to quickly locate all other members that have the word “Edit” anywhere in them:
This allows us to quickly see all[/u] of the edit related methods/properties/events and more quickly find what we are looking for.
Searching for Keywords
This new intellisense filtering feature of VS 2010 is useful for searching for any member – regardless of what word it starts with. For example, if we want to enable paging on a datagrid and can’t remember how to-do it, we could just type “GridView1.Paging” and it would automatically filter out everything but members that have the word paging. Notice below how no members on the GridView class actually start with the word “Paging” – but I am still finding the two members that do have paging in them later in their names:
Searching for Types
This new intellisense filtering capability of VS 2010 is also useful for quickly finding classes and types. For example, when we type “List” to declare a variable, the editor will provide automatic filtering to show all types that have the word “List” somewhere in them (including IList<> and SortedList<> –which do not start with List):
This makes it much easier to find type names you can’t entirely remember – without having to resort to searching through the object browser and/or using help documentation.
Pascal Case Intellisense
The .NET Framework naming guidelines specify that type and member names should be “Pascal Cased” by default. This means that each word in a type or member should start with a capitalized letter (for example: PageIndexChanged).
VS 2010’s intellisense filtering support now enables you to take advantage of this to quickly find and filter methods based on their pascal naming pattern. For example, if we typed “GridView1.PIC” VS 2010 would filter to show us the members that have PIC in their name, as well as those members which have a pascal cased name where the word segments start with that letter sequence:
Notice above how PIC caused both “PageIndexChanged” and “PageIndexChanging” to show up. This saves us a few keystrokes when resolving either member or type names.
Go to my home page for more posts
To help illustrate this intellisense improvements coming with VS 2010, let’s start by doing a simple scenario in VS 2008 where we want to write some code to enable an editing scenario with a GridView control.
Code Intellisense with VS 2008
We might start off by typing “GridView1.Edit” to bring up intellisense to see what Edit members are available on the control. Doing this with VS 2008 brings up the intellisense drop-down and filters the current location in the dropdown to the members that start with the word “Edit”:
This is great if the method/property/event we want to work with starts with “Edit” – but doesn’t really help us if the “Edit” member we are looking for starts with something else (for example: the “RowEditing” event or the “SetEditRow()” helper method). We have to either manually scroll up and down looking for the other edit members, or pull up the object browser or help system to find them.
Code Intellisense with VS 2010
Let’s now try out the same scenario with VS 2010. When we type “GridView1.Edit” within VS 2010 we’ll find that the EditIndex property is still highlighted by default. But the intellisense list has also been filtered so that it enables you to quickly locate all other members that have the word “Edit” anywhere in them:
This allows us to quickly see all[/u] of the edit related methods/properties/events and more quickly find what we are looking for.
Searching for Keywords
This new intellisense filtering feature of VS 2010 is useful for searching for any member – regardless of what word it starts with. For example, if we want to enable paging on a datagrid and can’t remember how to-do it, we could just type “GridView1.Paging” and it would automatically filter out everything but members that have the word paging. Notice below how no members on the GridView class actually start with the word “Paging” – but I am still finding the two members that do have paging in them later in their names:
Searching for Types
This new intellisense filtering capability of VS 2010 is also useful for quickly finding classes and types. For example, when we type “List” to declare a variable, the editor will provide automatic filtering to show all types that have the word “List” somewhere in them (including IList<> and SortedList<> –which do not start with List):
This makes it much easier to find type names you can’t entirely remember – without having to resort to searching through the object browser and/or using help documentation.
Pascal Case Intellisense
The .NET Framework naming guidelines specify that type and member names should be “Pascal Cased” by default. This means that each word in a type or member should start with a capitalized letter (for example: PageIndexChanged).
VS 2010’s intellisense filtering support now enables you to take advantage of this to quickly find and filter methods based on their pascal naming pattern. For example, if we typed “GridView1.PIC” VS 2010 would filter to show us the members that have PIC in their name, as well as those members which have a pascal cased name where the word segments start with that letter sequence:
Notice above how PIC caused both “PageIndexChanged” and “PageIndexChanging” to show up. This saves us a few keystrokes when resolving either member or type names.
Go to my home page for more posts
相关文章推荐
- vs2010中 js的intellisense(智能提示) 和 Snippets(代码块)
- vs2010中 js的intellisense(智能提示) 和 Snippets(代码块)
- vs2010中 js的intellisense(智能提示) 和 Snippets(代码块)
- IDE-Sublime【2】-代码智能提示插件SublimeCodeIntel的安装
- 艾伟_转载:VS 2010 和 .NET 4.0 系列之《VS 2010代码智能提示的改进》篇
- VS2010代码补全以及智能提示
- VS2010智能感知代码提示文字变成英文解决办法一例
- web应用程序中App_Code文件夹里的类书写代码没有智能提示
- vs2010显示代码智能提示 Visual AssistX for vs2010
- 一起谈.NET技术,VS 2010 和 .NET 4.0 系列之《VS 2010代码智能提示的改进》篇
- [Sencha ExtJS & Touch] VS Code 的 Sencha 扩展(智能提示,代码导航和集成Build操作等)
- 使用 Sublime Text 做 Javascript 编辑器 - 集成 SublimeCodeIntel 实现代码智能提示及自动完成
- 把VS2010的智能代码提示和注解从英文变成中文
- VS2015 安装mvc4安装包以及vs2010 sp1后导致Razor语法失效代码不高亮(能正常运行)/视图页面无法智能提示(.cshtml)解决办法
- 使用 Sublime Text 做 Javascript 编辑器 - 集成 SublimeCodeIntel 实现代码智能提示及自动完成
- VS2010 代码智能提示
- VAX破解版支持VS2010和2013,代码智能提示,安装就能用,不用替换文件
- 开启Xamarin.Forms的智能感知(代码提示功能)
- 页面版文本框智能提示JS代码
- 五小步让VS Code支持AngularJS智能提示