Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

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




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




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="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <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$;
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.