Export (0) Print
Expand All
Expand Minimize

Namespace Element (IntelliSense Code Snippets)

Specifies the namespace that must be imported for the code snippet to compile and run.


  
    
      
        
          
<Namespace>
    Namespace
</Namespace>

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

Attributes

None.

Child Elements

None.

Parent Elements

Element

Description

Import

Imports the specified namespace.

A text value is required.

This text specifies a namespace that the code snippet assumes is imported.

The Namespace element is only supported for Visual Basic projects.

The namespace specified in the Namespace element is automatically added to an Imports Statement (.NET Namespace and Type) statement at the beginning of the code, if it does not already exist.

The following code example imports the System.Data namespace.

<CodeSnippets xmlns="http://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>

Community Additions

ADD
Show:
© 2014 Microsoft