更新:2007 年 11 月
指定 Visual Studio 插入代码段的方式。
<SnippetType>
    SurroundsWith/Expansion
<SnippetType>
属性和元素
以下几节描述了属性、子元素和父元素。
属性
无。
子元素
无。
父元素
| 元素 | 说明 | 
|---|---|
| 将 SnippetType 元素分组。 | 
文本值
此文本值必须为以下值之一。
- SurroundsWith:允许将此代码段放置在一段选定的代码周围。 
- Expansion:允许将代码段插入到光标处。 
- Refactoring:指定在 Visual C# 重构过程中使用此代码段。不能在自定义代码段中使用 Refactoring。 
示例
下面的代码段的 SnippetType 元素的值为 Expansion。它指示可以将此代码段插入到光标处。
<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>