Udostępnij za pośrednictwem


Imports Element (IntelliSense Code Snippets)

Groups individual Import elements.

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

<Imports>
    <Import>... </Import>
<Imports>

Attributes and Elements

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

Attributes

None.

Child Elements

Element

Description

Import

Optional element.

Contains the imported namespaces for the code snippet. There may be zero or more Import elements in an Imports element.

Parent Elements

Element

Description

Snippet

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

Remarks

The Imports element is only supported for Visual Basic projects.

Example

The following example shows a code snippet that requires the namespaces System.Data and System.Xml to be imported.

<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>
                <Import>
                    <Namespace>System.Xml</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