Type Element (IntelliSense Code Snippets)
Specifies the type of the object.
<CodeSnippets>
<CodeSnippet>
<Snippet>
<Declarations>
<Object>
<Type>
<Type>
Type
</Type>
Attributes and Elements
The following sections describe attributes, child elements, and parent elements.
Attributes
None.
Child Elements
None.
Parent Elements
Element |
Description |
---|---|
Defines the object fields of the code snippet that you can edit. |
Text Value
A text value is required.
This text specifies the type of the object.
Remarks
The Object element is used to identify an item that is required by the code snippet but is likely to be defined outside of the snippet itself. For example, Windows Forms controls, ASP.NET controls, object instances, and type instances should be declared as objects. Object declarations require that a type be specified, which is done with the Type element.
Example
The following example uses the Type element to declare the type of an object in a code snippet.
<CodeSnippets xmlns="https://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<!-- Insert Header information here. -->
</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">
<!-- Insert code here. -->
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>