次の方法で共有


Assembly 要素 (IntelliSense コード スニペット)

更新 : 2007 年 11 月

コード スニペットによって参照されるアセンプリの名前を指定します。

<Assembly>
    AssemblyName
</Assembly>

属性と要素

以降のセクションでは、属性、子要素、および親要素について説明します。

属性

なし。

子要素

なし。

親要素

要素

説明

Reference

コード スニペットで参照する必要のあるアセンブリについての情報が格納されます。

テキスト値

テキスト値が必要です。

このテキストで、コード スニペットが参照するアセンブリを指定します。

解説

Assembly 要素は、Visual Basic のコード スニペットでのみサポートされます。

Assembly 要素のテキスト値は、アセンブリの表示名 (System.dll など) で指定することも、厳密な名前 (System,Version=1.0.0.1,Culture=neutral,PublicKeyToken=9b35aa323c18d4fb1 など) で指定することもできます。

使用例

次のコード スニペットは、アセンブリ System.Data.dll を参照しています。コード スニペットを挿入すると、この参照がプロジェクトに追加されます。

<CodeSnippets xmlns="https://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <Title>Create a data adapter</Title>
            <Description>Creates a SqlDataAdapter object.</Description>
            <Author>Microsoft Corporation</Author>
            <Shortcut>createadapter</Shortcut>
        </Header>
        <Snippet>
            <References>
                <Reference>
                    <Assembly>System.Data.dll</Assembly>
                    <Url>https://www.microsoft.com</Url>
                </Reference>
            </References>
            <Imports>
                <Import>
                    <Namespace>System.Data</Namespace>
                </Import>
            </Imports>
            <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="VB">
                <![CDATA[
                    daCustomers = new SqlClient.SqlDataAdapter();
                    selectCommand = new SqlClient.SqlCommand($SQL$);
                    daCustomers.SelectCommand = selectCommand;
                    daCustomers.SelectCommand.Connection = $Connection$;
                ]]>
            </Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>

参照

概念

コード スニペット スキーマ リファレンス