SnippetTypes 元素(IntelliSense 代码段)

对各个 SnippetType 元素进行分组。

<SnippetTypes>
    <SnippetType>... </SnippetType>
    <SnippetType>... </SnippetType>
<SnippetTypes>

特性和元素

以下几节描述了属性、子元素和父元素。

特性

无。

子元素

元素

说明

SnippetType

可选元素。

指定 Visual Studio 如何将代码段插入到代码中。 SnippetTypes 元素中可能有零个或零个以上的 SnippetType 元素。

父元素

元素

说明

Header

指定有关代码段的常规信息。

备注

如果 SnippetTypes 元素不存在,则代码段可以插入到代码中的任何位置。

示例

在下面的示例中,SnippetType 元素的值为 Expansion。 该值指示 Visual Studio 2005 可将代码段插入到光标当前所在的位置。

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

请参见

概念

代码段架构参考