カスタムスニペットのテンプレ
VisualStudioのスニペットはユーザーが自由に作成することができる。そのスニペットファイルのテンプレートを書いてみた。拡張子は(.snippet)にする。Shortcutタグは設定しておくととても便利。
コード
<?xml version="1.0" encoding="utf-8"?> <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> <CodeSnippet Format="1.0.0"> <Header> <Title>テンプレ</Title> <Description>テンプレです</Description> <Shortcut>hello</Shortcut> </Header> <Snippet> <!--テンプレートのマニュアル http://msdn.microsoft.com/ja-jp/library/vstudio/ms165394.aspx--> <!--<References> <Reference> <Assembly>test.dll</Assembly> </Reference> </References>--> <!--<Imports> <Import> <Namespace>System.Windows.Forms</Namespace> </Import> </Imports>--> <!--<Declarations> <Literal> <ID>SqlConnString</ID> <ToolTip>Replace with a SQL connection string.</ToolTip> <Default>"SQL connection string"</Default> </Literal> <Object> <ID>SqlConnection</ID> <Type>System.Data.SqlClient.SqlConnection</Type> <ToolTip>Replace with a connection object in your application.</ToolTip> <Default>dcConnection</Default> </Object> </Declarations>--> <Code Language="VB"> <![CDATA[ Hello, Snippet ]]> </Code> </Snippet> </CodeSnippet> </CodeSnippets>