Declarations 요소(IntelliSense 코드 조각)

편집할 수 있는 코드 조각의 일부를 구성하는 리터럴과 개체를 지정합니다.

<Declarations>
    <Literal>... </Literal>
    <Object>... </Object>
</Declarations>

특성 및 요소

다음 단원에서는 특성, 자식 요소 및 부모 요소에 대해 설명합니다.

특성

없음

자식 요소

요소

설명

Literal

선택적 요소입니다.

편집할 수 있는 코드 조각의 리터럴을 정의합니다. Declarations 요소에 Literal 요소가 0개 이상 있을 수 있습니다.

Object

선택적 요소입니다.

편집할 수 있는 코드 조각의 개체를 정의합니다. Declarations 요소에 Object 요소가 0개 이상 있을 수 있습니다.

부모 요소

요소

설명

Snippet

코드 조각에 대한 참조, 가져오기, 선언 및 코드가 포함되어 있습니다.

예제

다음 코드 예제에서는 ID 요소 값이 SQL인 리터럴과 ID 요소 값이 Connection인 개체를 선언하는 방법을 보여 줍니다.

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

참고 항목

개념

코드 조각 스키마 참조