在Visual Studio中隐藏XML注释

编程入门 行业动态 更新时间:2024-10-23 04:40:37
本文介绍了在Visual Studio中隐藏XML注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在Visual Studio中,是否有一种方法可以将xml注释隐藏在每个方法的开头?这些注释很重要,但是当我跟踪错误或单步执行代码时,不需要看这些注释. 也不希望它们被折叠,我正在寻找使它们隐藏(甚至不可见)的解决方案.

Is there a way to hide the xml comments at the head of each method in visual studio? These comments are important, but I don''t need to see them when I''m tracking down bugs or stepping through code. Not looking for them to be collapsed either, I''m looking for a solution that makes them hidden (not even visible).

推荐答案

写一个add-在VS2010中,它将为您做到这一点.标准版本不会为您隐藏这些版本,折叠是没有外接程序时最好的选择.但是,如果您编写该加载项,则可以为此赢得一些收益. 构建VS2010加载项并赢得Zune [ ^ ] 找到了这篇文章,展示了如何编写宏来更改显示的内容,然后将其折叠. 收起VB .NET或C#中的所有XML注释 [ ^ ] 当然,它仍然是折叠的,不是隐藏的,但是您可以对其进行修改以执行您想要的操作. Write an add-in for VS2010 that will do that for you. The standard versions won''t hide those for you, collapsing is the best you can do without an add-in. But, if you write that add-in, you could win something on here for it. Build a VS2010 Add-in and win a Zune[^] Found this post that shows how to write a macro to change what is shown then it''s collapsed. Collapse All XML Comments in VB .NET or C#[^] Of course, it''s still collapsed, not hidden, but you could modify it to do what you''re wanting.

我通常会折叠所有东西.在VS 2005中,转到,将所有内容折叠到其基本定义,包括注释(也可以从上下文菜单中到达).这与在编辑器的左边缘使用小号正负号折叠所有内容具有相同的效果.然后,您可以扩展所需的方法,或者如果您逐行调试器中的内容,它将自动扩展您要进入的方法.在同一菜单项中,还有一些其他选项可用来进行其他折叠/展开功能. I usually collapse everything. In VS 2005 go to to collapse everything to its base definition including the comments (you can also get there from the context menu). This has the same effect as using the little plus/minus sign in the left hand margin of the editor to collapse everything. Then you can expand just what methods you need, or if you''re stepping through things in the debugger line by line it will auto-expand methods that you step into. There are some other options in the same menu item to so some other collapse/expand functions.

您可以编写一个命令行实用程序,该实用程序将从空格开头的文件中删除所有行,然后至少在使用C#时使用三斜杠("///")....如果您的代码受版本控制,那应该不是问题.然后,您只需要将一个文件夹拖到工具上就可以了,这很神奇……应该花一两个小时才能写出来……如果您已经熟悉了正则表达式,那么花的时间会更少. You could write a command-line utility that would remove all lines from files that start with whitespace and a triple slash ("///")... at least if you''re working with C#. If your code is under version control, that shouldn''t be a problem. Then you''d just have to drag a folder onto the tool and it would do it''s magic... shouldn''t take but an hour or two to write... less if you are already familiar with regular expressions.

更多推荐

在Visual Studio中隐藏XML注释

本文发布于:2023-11-13 00:52:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1582958.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:注释   Visual   Studio   XML

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!