Sdílet prostřednictvím


Import Element (IntelliSense Code Snippets)

Specifies the imported namespaces used by an IntelliSense Code Snippet.

<CodeSnippets>
  <CodeSnippet>
    <Snippet>
      <Imports>
        <Import>

<Import>
    <Namespace>... </Namespace>
</Import>

Attributes and Elements

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

Attributes

None.

Child Elements

Element

Description

Namespace

Required element.

Specifies the namespace used by the code snippet. There must be exactly one Namespace element in an Import element.

Parent Elements

Element

Description

Imports

Grouping element for Import elements.

Remarks

The Imports element is only supported for Visual Basic projects.

Example

The following example shows a code snippet that imports the namespace System.Data.

<CodeSnippets xmlns="https://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <!-- Insert Header information here. -->
        </Header>
        <Snippet>
            <Imports>
                <Import>
                    <Namespace>System.Data</Namespace>
                </Import>
            </Imports>
            <Declarations>
                <!-- Insert literal and object declarations here. -->
            </Declarations>
            <Code Language="VB">
                <!-- Insert code here. -->
            </Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>

See Also

Concepts

Code Snippets Schema Reference