Aracılığıyla paylaş


Default Element (IntelliSense Code Snippets)

Specifies the default value of the literal or object for an IntelliSense Code Snippet.

<CodeSnippets>
  <CodeSnippet>
    <Snippet>
      <Declarations>
        <Literal>
          <Default>
            <Object>
              <Default>

<Default>
    Default value
</Default>

Attributes and Elements

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

Attributes

None.

Child Elements

None.

Parent Elements

Element

Description

Literal

Defines the literal fields of the code snippet that you can edit.

Object

Defines the object fields of the code snippet that you can edit.

Text Value

A text value is required.

This text specifies the default value of the literal or object that fills the fields of the code snippet that you can edit.

Example

The following code shows a literal with a default value of SQL and an object with a default value of Connection. The text value of the Default element represents the literal or object when the code snippet is inserted into a project.

<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>
            <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">
                <![CDATA[
                    daCustomers = new SqlClient.SqlDataAdapter();
                    selectCommand = new SqlClient.SqlCommand($SQL$);
                    daCustomers.SelectCommand = selectCommand;
                    daCustomers.SelectCommand.Connection = $Connection$;
                ]]>
            </Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>

See Also

Concepts

Code Snippets Schema Reference