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;


posted on 2012-10-17 10:04 canny_strive 阅读(195) 评论(0) 收藏 举报
浙公网安备 33010602011771号