Insert Code Snippets (Visual J#)

Started by sukishan, Jul 14, 2009, 04:49 PM

Previous topic - Next topic

sukishan

You can insert IntelliSense Code Snippets using the navigation tools in the Code Editor or by dragging files from Windows Explorer. When you know the name of the snippet you want to insert, you can do so by typing its shortcut. When you need to browse for an appropriate snippet, you can use the snippet picker, which gives you categorized lists of snippets to choose from.

There are three ways to insert code snippets. You can insert them using the Intelisense menu, type a shortcut, or drag them from Windows Explorer. The following procedures show you how to insert IntelliSense Code Snippets:

To insert a snippet by browsing in the Code Editor

Right-click the Code Editor where you want to insert the code and point to Intelisense.

On the shortcut menu click Expansion.

-or-

Type a question mark followed by TAB in the Code Editor to open the code snippet picker.

On the snippet picker, navigate to the task of your choice and click it.

The snippet code inserts into your code. Once you add the snippet into your code, you can use the Code Editor to customization it. For example you can replace variable names with more appropriate names.

To insert a snippet when you know its shortcut

Type the shortcut for the snippet in the Code Editor followed by TAB. The snippet will be inserted.

-or-

Type the first few characters of the shortcut for the snippet in the Code Editor, followed by a TAB. A picker will appear with the list of snippets whose shortcuts begin with the characters you typed.

To insert a snippet into your code using Windows Explorer


Open Windows Explorer.

Navigate in Windows Explorer to the folder that contains the file you want to insert. If you choose the default location for the installation of Visual Studio 2005, the snippets are stored in C:\Program Files\Microsoft Visual Studio 8\V C:\Program Files\Microsoft Visual Studio 8\VJ#\Expansions\.

Drag the file from Windows Explorer to the place in your code where you want to insert it.
A good beginning makes a good ending