在Visual Studio中更改默认的XML注释片段 [英] Change default XML comment snippet in Visual Studio

查看:121
本文介绍了在Visual Studio中更改默认的XML注释片段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在Visual Studio中点击///时,是否可以从中更改结果片段:

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

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

对此吗?:

/// <summary></summary>

推荐答案

以下是至少在VS2010中有效的解决方案.

Here is the solution working in at least VS2010.

将底部代码另存为文件summ.snippet.
Visual Studio 2010/工具/代码段管理器
单击导入,浏览到文件.使用默认选项保存.

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

结果

/// <summary>  </summary>

将光标放在标签的中间,可以输入内容.

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

这是summ.snippet的内容

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>

这篇关于在Visual Studio中更改默认的XML注释片段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆