16 de jun. de 2019

How to create a C# Snippet in Visual Studio Community


  1. Create a new XML File
  2. Copy de template bellow.
  3. Change de Title, Author, Descsription, Shortcut and mainly the CDATA content.
  4. Save as FileName.snippet
  5. Open
    Tool - Snippet Manager and import the XML file into CSharp "My Code Snippets"
  6. Done

Now, you just need to write the Shortcut and press TAB.



 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <Title></Title>
        </Header>
        <Snippet>
            <Code Language="">
                <![CDATA[]]>
            </Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>

Nenhum comentário: