SnippetType Element (IntelliSense Code Snippets)

Specifies how Visual Studio inserts the code snippet.

<CodeSnippets>
  <CodeSnippet>
    <Header>
      <SnippetTypes>
        <SnippetType>

<SnippetType>
    SurroundsWith/Expansion
<SnippetType>

Attributes and Elements

The following sections describe attributes, child elements, and parent elements.

Attributes

None.

Child Elements

None.

Parent Elements

Element

Description

SnippetTypes

Groups SnippetType elements.

Text Value

The text value must one of the folllowing values.

  • SurroundsWith: allows the code snippet to be placed around a selected piece of code.

  • Expansion: allows the code snippet to be inserted at the cursor.

  • Refactoring: specifies that the code snippet is used during Visual C# refactoring. Refactoring cannot be used in custom code snippets.

Example

The SnippetType element of the following code snippet has the value Expansion. This indicates that the code snippet can be inserted at the cursor.

<CodeSnippets xmlns="https://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <Title>Copy File</Title>
            <Author>Microsoft Corporation</Author>
            <Description>Copies a file and saves it as another file.</Description>
            <HelpUrl>www.microsoft.com</HelpUrl>
            <SnippetTypes>
                <SnippetType>Expansion</SnippetType>
            </SnippetTypes>
            <Keywords>
                 <Keyword>File copying</Keyword>
                 <Keyword>Copying files</Keyword>
            </Keywords>
            <Shortcut>copyfile</Shortcut>
        </Header>
        <Snippet>
            <!-- Insert snippet information here -->
        </Snippet>
    </CodeSnippet>
</CodeSnippets>

See Also

Concepts

Code Snippets Schema Reference