共用方式為


ToolTip 項目 (IntelliSense 程式碼片段)

更新:2007 年 11 月

描述程式碼片段中的預期值和文字或物件的使用,當 Visual Studio 將程式碼片段插入專案時,它會顯示在工具提示中。

<ToolTip>
    ToolTip description
</ToolTip>

屬性和項目

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

屬性

無。

子項目

無。

父項目

項目

描述

Literal

定義可以編輯的程式碼片段的常值欄位。

Object

定義可以編輯的程式碼片段的物件欄位。

文字值

需要文字值。

此文字可指定程式碼片段中與物件或常值關聯的 ToolTip 描述。

備註

在插入程式碼片段後,當滑鼠停留在文字或物件上時,會顯示工具提示文字。

範例

下列範例會示範如何為 LiteralObject 項目宣告 ToolTip 項目。

<CodeSnippets xmlns="https://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <!-- Insert Header information here. -->
        </Header>
        <Snippet>
            <Declarations>
                <Literal>
                    <ID>SQL</ID>
                    <ToolTip>Replace with a SQL connection string.</ToolTip>
                    <Default>"SQL connection string"</Default>
                </Literal>
                <Object>
                    <ID>Connection</ID>
                    <Type>System.Data.SqlClient.SqlConnection</Type>
                    <ToolTip>Replace with a connection object in your application.</ToolTip>
                    <Default>dcConnection</Default>
                </Object>
            </Declarations>
            <Code Language="CSharp">
                <!-- Insert code here. -->
            </Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>

請參閱

概念

程式碼片段結構描述參考