Create a new text file named method.snippet and paste the following: <?xml version="1.0" encoding="utf-8" ?> <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> <CodeSnippet Format="1.0.0"> <Header> <Title>xmethod</Title> <Shortcut>xmethod</Shortcut> <Description>Code snippet for method extension</Description> <Author>Gary Sun</Author> <SnippetTypes> <SnippetType>Expansion</SnippetType> </SnippetTypes> </Header> <Snippet> <Declarations> <Literal> <ID>methodname</ID> <ToolTip>Method name</ToolTip> <Function>MethodName()</Function> <Default>MethodNamePlaceholder</Default> </Literal> <Literal> <ID>methodtype</ID> <ToolTip>Method type</ToolTip> <Function>MethodType()</Function> <Default>void</Default> </Literal> <Literal> <ID>classtype</ID> <ToolTip>Class type</ToolTip> <Function>ClassType()</Function> <Default>ClassPlaceholder</Default> </Literal> <Literal> <ID>argname</ID> <ToolTip>Argument name</ToolTip> <Function>Argumentname()</Function> <Default>ArgPlaceholder</Default> </Literal> </Declarations> <Code Language="csharp"><![CDATA[public static $methodtype$ $methodname$ (this $classtype$ $argname$ ) { $end$ }]]> </Code> </Snippet> </CodeSnippet> </CodeSnippets> Copy your file into the snippets folder in Windows Explorer:
Once you save your file the snippets are automatically loaded, so you can now open visual studio and use it. |
|
來自: gingging > 《VS Studio》