Introduction to Intellisense in Visual Studio 2008



In this article, we will discuss about Intellisense features and adding those features to our classes and methods. Intellisense is a set of features provided by Visual Studio to ease our coding. We can reduce our coding time by using Intellisense in a better way. We will look into it by a sample application.

Create a console application named as IntellisenseDemo in Visual Studio 2008. VS Intellisense helps us by providing names of valid members of a class, parameter names and its types and complete declaration of an identifier in our code. First, we look each feature present in Intellisense one by one.

List Members:

We can get a list of valid members of a type like class by typing its name followed by "." as shown below:

1.gif

By default, Auto list members will be enabled. We can manually List members of a type by pressing Ctrl+J.

Parameter Info:

This will give information about parameters like its type, name and number of parameters for a method as shown below:

2.gif

We can invoke Parameter Info manually by using Ctrl+Shift+Space.

Quick Info:

This option will display the complete declaration of an identifier as shown below:

3.gif

We can get Quick Info of an identifier by placing a cursor over it. We can manually invoke it by Ctrl+K, Ctrl+I.

Complete Word:

This option will helps us to complete a word without typing full name of it. We can type first few letters of an identifier and press Ctrl+SpaceBar to complete the word. If we have multiple matches, it will show list of matching words in List Members popup.

Adding Parameter Info details to our code:

By using XML documentation comments (///, ... in VB) for a method, we can add information for displaying in Parameter Info and Quick Info box as shown below:

  
      ///
<summary>
        /// Appends s1 to s2 and returns it back.
        /// </summary>
        /// <param name="s1"></param>
        /// <param name="s2"></param>
        /// <returns>string</returns>
        static string TestIntellisense(string s1, string s2)
        {
            return s1 + s2;
        }
           4.gif


I am ending the things here. I hope this article will be helpful for all.

Up Next
    Ebook Download
    View all
    Learn
    View all