How to: Use Surround-with Code Snippets
Note
This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here
The following procedures describe how to use surround-with code snippets. Surround-with code snippets are available three ways: through a keyboard shortcut, through the Edit menu, and through the context menu.
To use surround-with code snippets through keyboard shortcut
In the Visual Studio IDE, open the file that you intend to edit.
In the Code Editor, select text to surround.
Type CTRL+K, CTRL+S.
Select the code snippet from the code snippet list using the mouse, or by typing the name of the code snippet and pressing TAB or ENTER.
To use surround-with code snippets through the Edit menu
In the Visual Studio IDE, open the file that you intend to edit.
In the Code Editor, select text to surround.
From the Edit menu, select IntelliSense and then select the Surround With command.
Select the code snippet from the code snippet inserter and then press TAB or ENTER.
Alternatively, you can type the name of the code snippet, and then press TAB or ENTER.
To use surround-with code snippets through the context menu
In the Visual Studio IDE, open the file that you intend to edit.
In the Code Editor, select text to surround.
Right-click the selected text and then select the Surround With command from the context menu.
Select the code snippet from the code snippet inserter and then press TAB or ENTER.
Alternatively, you can type the name of the code snippet, and then press TAB or ENTER.