自定义vs2008代码段
①.将以下代码保存为myshow.snippet(UTF-8编码):
复制内容到剪贴板
程序代码

<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title> 标题:自定义代码段示例</Title>
<Shortcut>myshow</Shortcut>
<Description> 描述:快速输入MessageBox.Show</Description>
<Author> 作者:dnawo</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
<SnippetType>SurroundsWith</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>msg1</ID>
<ToolTip> 变量1</ToolTip>
<Default>hello</Default>
</Literal>
<Literal>
<ID>msg2</ID>
<ToolTip> 变量3</ToolTip>
<Default>hi</Default>
</Literal>
</Declarations>
<Code Language="csharp"><![CDATA[MessageBox.Show("$msg1$" + "$msg2$");]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title> 标题:自定义代码段示例</Title>
<Shortcut>myshow</Shortcut>
<Description> 描述:快速输入MessageBox.Show</Description>
<Author> 作者:dnawo</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
<SnippetType>SurroundsWith</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>msg1</ID>
<ToolTip> 变量1</ToolTip>
<Default>hello</Default>
</Literal>
<Literal>
<ID>msg2</ID>
<ToolTip> 变量3</ToolTip>
<Default>hi</Default>
</Literal>
</Declarations>
<Code Language="csharp"><![CDATA[MessageBox.Show("$msg1$" + "$msg2$");]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
②. 选择菜单"工具→代码段管理器",导入myshow.snippet;
③.使用示例:
其 他说明
·$selected$变量表示在IDE环境中选中的代码段,这个变量通常在外侧代码段中使用;
·$end$变 量表示输入代码段后光标所处位置;