visual studio snippet备忘

一、C++

classheadercpp.snippet

<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <Title>类注释</Title>
            <Shortcut>===</Shortcut>
            <Description>类头文件注释</Description>
            <Author>airscrat</Author>
            <SnippetTypes>
                <SnippetType>Expansion</SnippetType>
                <SnippetType>SurroundsWith</SnippetType>
            </SnippetTypes>
        </Header>
        <Snippet>
            <Declarations>
            </Declarations>
            <Code Language="cpp">
                <![CDATA[/********************************************************
[Author  ]:Mr.Huang
[Email   ]:airscrat(at)qq(dot)com
[Content ]:$end$
/********************************************************/]]>
            </Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>

memberheadercpp.snippet

<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <Title>成员注释</Title>
            <Shortcut>+++</Shortcut>
            <Description>成员注释</Description>
            <Author>airscrat</Author>
            <SnippetTypes>
                <SnippetType>Expansion</SnippetType>
                <SnippetType>SurroundsWith</SnippetType>
            </SnippetTypes>
        </Header>
        <Snippet>
            <Declarations>
                <Literal>
                    <ID>name</ID>
                    <ToolTip>成员简介</ToolTip>
                    <Default>成员说明</Default>
                </Literal>
            </Declarations>
            <Code Language="cpp">
                <![CDATA[
                /**$name$$end$*/]]>
            </Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>

functionheadercpp.snippet

<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <Title>函数注释</Title>
            <Shortcut>---</Shortcut>
            <Description>函数注释</Description>
            <Author>airscrat</Author>
            <SnippetTypes>
                <SnippetType>Expansion</SnippetType>
                <SnippetType>SurroundsWith</SnippetType>
            </SnippetTypes>
        </Header>
        <Snippet>
            <Declarations>
                <Literal>
                    <ID>name</ID>
                    <ToolTip>函数简介</ToolTip>
                    <Default>类成员</Default>
                </Literal>
            </Declarations>
            <Code Language="cpp">
                <![CDATA[
                #pragma region $name$$end$
                /**
                [Contents]:$name$
                */
                $selected$
                //***************/
                #pragma endregion]]>
            </Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>

二、C#

classheadercs.snippet

<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <Title>类注释</Title>
            <Shortcut>===</Shortcut>
            <Description>类头文件注释</Description>
            <Author>airscrat</Author>
            <SnippetTypes>
                <SnippetType>Expansion</SnippetType>
                <SnippetType>SurroundsWith</SnippetType>
            </SnippetTypes>
        </Header>
        <Snippet>
            <Declarations>
            </Declarations>
            <Code Language="csharp">
                <![CDATA[/********************************************************
[Author  ]:Mr.Huang
[Email   ]:airscrat(at)qq(dot)com
[Content ]:$end$
/********************************************************/]]>
            </Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>

functionheadercs.snippet

<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <Title>函数注释</Title>
            <Shortcut>---</Shortcut>
            <Description>函数注释</Description>
            <Author>airscrat</Author>
            <SnippetTypes>
                <SnippetType>Expansion</SnippetType>
                <SnippetType>SurroundsWith</SnippetType>
            </SnippetTypes>
        </Header>
        <Snippet>
            <Declarations>
                <Literal>
                    <ID>name</ID>
                    <ToolTip>函数简介</ToolTip>
                    <Default>类成员</Default>
                </Literal>
            </Declarations>
            <Code Language="csharp">
                <![CDATA[
                #region $name$$end$
          /****************/ /// <summary> /// $name$ /// </summary> $selected$ //***************/ #endregion]]> </Code> </Snippet> </CodeSnippet> </CodeSnippets>

 快捷键:

(1)CTRL+K,CTRL+S

(2)CTRL+K,CTRL+X

...
...
 
 
...
...
 
 
...
...
 
 
...
...
 
posted @ 2017-12-26 11:13  松山居士  阅读(295)  评论(0编辑  收藏  举报