Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2005
Visual Studio
Visual C#
Code Snippets
 How to: Use Surround-with Code Snip...

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:

Want more? Here are some additional resources on this topic:

Visual C# Application Development 
How to: Use Surround-with Code Snippets 

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

  1. In the Visual Studio IDE, open the file that you intend to edit.

  2. In the Code Editor, select text to surround.

  3. Type CTRL+K, CTRL+S.

  4. 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

  1. In the Visual Studio IDE, open the file that you intend to edit.

  2. In the Code Editor, select text to surround.

  3. From the Edit menu, select IntelliSense and then select the Surround With command.

  4. 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

  1. In the Visual Studio IDE, open the file that you intend to edit.

  2. In the Code Editor, select text to surround.

  3. Right-click the selected text and then select the Surround With command from the context menu.

  4. 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.

See Also

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
This option is gone for me.      cmay   |   Edit   |   Show History

I have lost this option in VS.NET.

I used to use it all the time, now it is gone. I can't access it using any of the methods described in this article.

If anyone finds a way, please email me: cmay AT walshgroup.com

Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker