Created
January 27, 2015 13:24
-
-
Save venj/d6229b457a2e3f751057 to your computer and use it in GitHub Desktop.
Code Snippet for visual studio to generate class extension template. Trigger: vcext<TAB><TAB>
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> | |
<CodeSnippet Format="1.0.0"> | |
<Header> | |
<Title>Class Extension</Title> | |
<Shortcut>vcext</Shortcut> | |
<Description>Add Method To Existing Class With Extension</Description> | |
<Author>Venj Chu</Author> | |
<SnippetTypes> | |
<SnippetType>Expansion</SnippetType> | |
</SnippetTypes> | |
</Header> | |
<Snippet> | |
<Declarations> | |
<Literal> | |
<ID>namespace</ID> | |
<ToolTip>NameSpace Name</ToolTip> | |
<Default>MyNameSpace</Default> | |
</Literal> | |
<Literal> | |
<ID>classname</ID> | |
<ToolTip>Class Name</ToolTip> | |
<Default>MyClass</Default> | |
</Literal> | |
<Literal> | |
<ID>type</ID> | |
<ToolTip>Return Type</ToolTip> | |
<Default>void</Default> | |
</Literal> | |
<Literal> | |
<ID>methodname</ID> | |
<ToolTip>Method Name</ToolTip> | |
<Default>SomeMethod</Default> | |
</Literal> | |
<Literal> | |
<ID>attributes</ID> | |
<ToolTip>Attribute Type</ToolTip> | |
<Default>, int someValue</Default> | |
</Literal> | |
</Declarations> | |
<Code Language="csharp"> | |
<![CDATA[ | |
namespace $namespace$ | |
{ | |
public static class $classname$Extension | |
{ | |
public static $type$ $methodname$(this $classname$ self$attributes$) | |
{ | |
// Here goes real implementation. | |
} | |
} | |
} | |
]]> | |
</Code> | |
</Snippet> | |
</CodeSnippet> | |
</CodeSnippets> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment