共用方式為


SnippetTypes 項目 (IntelliSense 程式碼片段)

更新:2007 年 11 月

指定 Visual Studio 插入程式碼片段的方式。

<SnippetType>
    SurroundsWith/Expansion
<SnippetType>

屬性和項目

下列章節會說明屬性 (Attribute)、子項目和父項目。

屬性

子項目

父項目

項目

描述

SnippetTypes

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

請參閱

概念

程式碼片段結構描述參考