How to: Use surround-with code snippets
Applies to: Visual Studio Visual Studio for Mac
Note
This article applies to Visual Studio 2017. 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
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. Then, in the right-click context menu, select Snippet > Surround With.
Select the code snippet you want 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.