Deborah's Developer MindScape






         Tips and Techniques for Web and .NET developers.

April 7, 2010

VS 2010: Enhanced IntelliSense Matching

Filed under: C#,VB.NET,Visual Studio @ 1:27 am

One of the features of Visual Studio that really helps with programming productivity is IntelliSense. The IntelliSense List Members feature not only provides lists of valid members, it also short-cuts your typing of those members. And now with VS 2010, it is even better.

Here is an example of the Intellisense List Members using VS 2008.

In C#:

image

In VB:

image

Simply typing .R (or even .r) picks up the Retrieve method. Then you can press the tab key to select the highlighted entry. Or to save even more keystrokes, just type "(" to select the highlighted entry and continue the method call.

But what if you wanted to call the RetrieveById method? Then you had some more typing to do or arrow keys to press.

This is where Visual Studio 2010 Intellisense has been significantly improved. Now you can simply type "RB" to pick the RetrieveById method from the list.

NOTE: The letters must be capitalized.

Here is an example.

In C#:

image

In VB:

image

Then you can again press the tab key to select the highlighted entry. Or just type "(" to select the highlighted entry and continue the method call.

This ability to match is based on the Pascal casing of the member, which is a naming convention whereby each word in the member starts with a capital letter. (Here is yet another reason to get your team to follow good naming conventions!)

But this technique also works with camel casing (where each word starts with a capital letter except the first one, e.g. currentIndex), and with underscores (e.g. Retrieve_By_Id).

Another new feature in the IntelliSense List Members is "contains" style matching instead of "starts with" style matching. So if in the above example, there were other methods, such as AddressRetrieve and AddressRetrieveById, they would appear when searching for retrieve.

In C#:

image

In VB:

image

Use this technique to quickly find and select the desired members.

Enjoy!

1 Comment

  1.   sandeep jakhotya — June 8, 2010 @ 2:22 pm    Reply

    The “contains” style matching instead of “starts with” style matching is really very goods feature that have been added.
    Is this maching also works with Input Controls like ComboBox and AutoComplete enabled TextBox too in VS 2010 ?

RSS feed for comments on this post. TrackBack URI

Leave a comment

© 2014 Deborah's Developer MindScape   Provided by WPMU DEV -The WordPress Experts   Hosted by Microsoft MVPs