Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
618 views
in Technique[技术] by (71.8m points)

Change default XML comment snippet in Visual Studio

When I hit /// in Visual Studio, is it possible to change the resulting snippet from this:

/// <summary>
/// 
/// </summary>

to this?:

/// <summary></summary>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Here is the solution working in at least VS2010.

Save the bottom code as a file summ.snippet.
Visual Studio 2010 / Tools / Code Snippet Manager
Click import, browse to file. Save with default options.

Now goto your code window and type summ + tab + tab

Result

/// <summary>  </summary>

with the cursor in the middle of the tag, ready to type.

Here is the contents of the summ.snippet

<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">

    <CodeSnippet Format="1.0.0">
        <Header>
                <Title>Summary - inline</Title>
                <Description>Created inline summary comment tag</Description>
                <Author>Mike Vanderkley</Author>
                <Shortcut>summ</Shortcut>
                <SnippetTypes>
                        <SnippetType>Expansion</SnippetType>
                </SnippetTypes>
        </Header>
        <Snippet>
            <Code Language="csharp">
                <![CDATA[/// <summary> $end$ </summary>]]>
            </Code>
    </Snippet>
  </CodeSnippet>

</CodeSnippets>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...