Sunday 30 December 2018

Customized Code snippet(Ctrl+K,Ctrl+B)

Code snippets are for ease access of the complete block of code in a tiny word.For example prop keywoed in the visua studio intellisense generates the get and set properties for a word.

The below is the code for generating the Method with the Console write property


<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <Title>method</Title>
            <Shortcut>method</Shortcut>
            <Description>Code snippet for method</Description>
            <Author>UserName</Author>
            <SnippetTypes>
                <SnippetType>Expansion</SnippetType>
            </SnippetTypes>
        </Header>
        <Snippet>
            <Declarations>
                <Literal>
                    <ID>methodA</ID>
                    <ToolTip>Method name</ToolTip>
                    <Function>MethodA()</Function>
                    <Default>MethodA</Default>
                </Literal>
            </Declarations>
            <Code Language="csharp"><![CDATA[public void $methodA$ ()
    {
        Console.WriteLine();
    }]]>
            </Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>

No comments:

Post a Comment