Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

How to: Assign a Shortcut Name to a Snippet 

Shortcut names provide a way for you to insert IntelliSense Code Snippets into your code by typing a shortcut name and then pressing Tab. The shortcut name for an IntelliSense Code Snippet is changed by modifying the XML .snippet file.

To change the shortcut name for a snippet

  1. Locate the .snippet file for the snippet that you want to edit. The snippets that appear in the picker are stored as files in subfolders of specific file locations. The file locations can be examined and changed using the Code Snippets Manager.

  2. On the File menu, click Open and then click File.

  3. Click the file you want to open, and then click Open.

  4. In the editor, locate the Header element of the code snippet.

  5. Add a Shortcut element as a child of the Header element. Make the text value of the Shortcut element the shortcut name. For example, if the following code were part of a Visual Basic code snippet XML file, you would type "MyShortcut" and press Tab to insert the code snippet.

    NoteNote

    You must press Tab twice to insert Visual C# and Visual J# code snippets.

    <Shortcut>MyShortcut</Shortcut>

    NoteNote

    The text value of a Shortcut element can only contain alphanumeric characters, hyphens ( - ), and underscores ( _ ).

  6. Save the file.

See Also

Community Additions

ADD
Show:
© 2015 Microsoft