Here we’re going to show how easy it is to extend Visual Studio by adding a new snippet that is both an "Expansion" and "SurroundWith" type. This snippet will put in a System.Diagnostics.Trace statement for us.
First we create the following XML. Note the "SnippetTypes", the "ToolTip", and the "Code" elements. We save this file to the Visual Studio Snippets folder which in the case of this particular box with VS05 is "C:\Program Files (x86)\Microsoft Visual Studio 8\VC#\Snippets\1033\Visual C#".
Now if we go into the IDE and type trace then hit tab tab in quick succession to execute the expansion snippet we get the following code snippet,
To use the SurroundWith snippet type press ctrl+k then ctrl+s in quick succession. By highlighting the string variable myString we get the following code snippet,