358Microsoft Visual Studio 2010: A Beginner’s Guide

<Literal>

<ID>return</ID>

<Default>void</Default> <ToolTip>Return value</ToolTip>

</Literal>

<Literal>

<ID>methodName</ID>

<Default>MethodName</Default> <ToolTip>Name of Method</ToolTip>

</Literal>

<Literal>

<ID>paramList</ID> <Default>int p1</Default> <ToolTip>

Comma-separated list of parameters </ToolTip>

</Literal>

</Declarations>

<Code Language="csharp"> <![CDATA[

$access$ $return$ $methodName$($paramList$)

{

$end$

}]]>

</Code>

</Snippet>

</CodeSnippet>

Managing the Snippet Library

To use a snippet, you can either copy the snippet into a VS folder or use a VS tool called the Snippet Manager. This section will explain how to make the method snippet, created in the preceding section, available to your code.

File Folders Holding Snippets

The local snippets folder is located at \Users\<your name>\Documents\Visual Studio 2010\Code Snippets. You’ll see a set of folders for each language/technology, which each have subfolders for organizing snippets. Copy and paste the snippet file into one of these folders, such as Visual C#\My Code Snippets, and the snippet will be immediately available to your code.

The local snippets folder makes a snippet available to your machine login. You can also make the snippet available to everyone who logs on to the machine by copying the snippet to a global snippet folder, located at \Program Files\Microsoft Visual Studio

Page 381
Image 381
Microsoft 9GD00001 manual Managing the Snippet Library, File Folders Holding Snippets