This documentation is archived and is not being maintained.

Snippet Element (IntelliSense Code Snippets) 

Specifies the references, imports, declarations, and code for the code snippet.

    <References>... </References>
    <Imports>... </Imports>
    <Declarations>... </Declarations>
    <Code>... </Code>

The following sections describe attributes, child elements, and parent elements.



Child Elements

Element Description


Required element.

Specifies the code that you want to insert into a documentation file. There must be exactly one Code element in a Snippet element.


Optional element.

Specifies the literals and objects that make up the parts of a code snippet that you can edit. There may be zero or one Declarations elements in a Snippet element.


Optional element.

Groups individual Import elements. There may be zero or one Imports elements in a Snippet element.


Optional element.

Groups individual Reference elements. There may be zero or one References elements in a Snippet element.

Parent Elements

Element Description


Allows you to specify a heading and multiple IntelliSense Code Snippets, which you can insert into Visual Studio code files.

The following code shows you how to use the Snippet element and its child elements to write a Visual C# code snippet that creates a SqlDataAdapter.

<CodeSnippets xmlns="">
    <CodeSnippet Format="1.0.0">
            <Title>Create a data adapter</Title>
            <Description>Creates a SqlDataAdapter object.</Description>
            <Author>Microsoft Corporation</Author>
                    <ToolTip>Replace with a SQL connection string.</ToolTip>
                    <Default>"SQL connection string"</Default>
                    <ToolTip>Replace with a connection object in your application.</ToolTip>
            <Code Language="CSharp">
                    daCustomers = new SqlClient.SqlDataAdapter();
                    selectCommand = new SqlClient.SqlCommand($SQL$);
                    daCustomers.SelectCommand = selectCommand;
                    daCustomers.SelectCommand.Connection = $Connection$;