Literal Element (IntelliSense Code Snippets)
The document is archived and information here might be outdated

Literal Element (IntelliSense Code Snippets) 

Defines the literals of the code snippet that you can edit.

<Literal Editable="true/false">
   <ID>... </ID>
   <ToolTip>... </ToolTip>
   <Default>... </Default>
   <Function>... </Function>

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


Attribute Description


Optional Boolean attribute.

Specifies whether or not you can edit the literal after the code snippet is inserted. The default value of this attribute is true.

Child Elements

Element Description


Required element.

Specifies the literal's default value when you insert the code snippet. There must be exactly one Default element in a Literal element.


Optional element.

Specifies a function to execute when the literal receives focus in Visual Studio. There may be zero or one Function elements in a Literal element.


Required element.

Specifies a unique identifier for the literal. There must be exactly one ID element in a Literal element.


Optional element.

Describes the expected value and usage of the literal. There may be zero or one Tooltip elements in a Literal element.

Parent Elements

Element Description


Contains the literals and objects of a code snippet that you can edit.

The Literal element is used to identify a replacement for a piece of code that is entirely contained within the snippet, but will likely be customized after it is inserted into the code. For example, literal strings, numeric values, and some variable names should be declared as literals.

Literals and objects cannot contain an ID element with a value of end. The value $end$ is reserved, and is used to mark the location to place the cursor after the code snippet is inserted.

The following code example shows how to declare a literal with an ID element value of SQL. The literal is referenced in the Code element by using the default delimiter. In this example, the literal is referenced with $SQL$.

<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$;
© 2016 Microsoft