Tag: 评论

为什么在使用“注释选择”注释多行选择时,Visual Studio会采用单行注释?

关于Visual Studio中的“ 注释选择”选项( Ctrl + K , Ctrl + C ),我总是想知道一些小问题。 当我评论此方法的实现时,使用单行注释格式。 private void Foo() { //Bar b = new Bar(); } 当我在这里评论来自构造函数的参数(部分行)时,使用分隔的注释格式。 private void Foo(Qux q) { Bar b = new Bar(/*q*/); } 在评论整个方法时会产生以下结果: //private void Foo() //{ // Bar b = new Bar(); //} 我觉得在最后一种情况下,分隔的评论格式会更合适,因为规范说: 单行注释扩展到源代码行的末尾。 定界注释可能跨越多行。 有人知道为什么在Visual Studio中注释多行选择时这被选为默认格式?

如何将所包含的项添加到文档注释中

我正在尝试编写文档注释但是我遇到了问题。 /// /// Inserts an element into the System.Collections.Generic.List at the specified /// index. /// 当我到达 Visual Studio认为我正在尝试添加另一个标签。 添加这样的评论的正确方法是什么(如果我可以在生成的帮助文本中点击它们,这将是一个额外的奖励)

使用Visual Studio 2015禁用注释的自动缩进

当我在安装了Resharper 9.0.0.0的Visual Studio 2015中保存C#文件时,我查看并搜索了禁用注释缩进的方法。 在开始编写实际代码之前,我想要伪代码。 然而,我一直在调整Visual Studio和Resharper的设置无济于事。 例如,我希望评论看起来像: private string ToggleString(string input) { // If input.length is between 1-100 // All the uppercase letters converted to lowercase. // All the lowercase letters converted to uppercase // else // Return a constructive message. return input; } 当我保存CTRL + s时 ,结果如下: private string ToggleString(string input) { // […]

以编程方式取消注释代码

如何以编程方式注释掉一些评论? 想想这样的事情: – void releaseA() { //ToDo: } //string A = “Test”; releaseA(); textbox1.Text = A; 我怎样才能实现这一点并实现方法releaseA来注释掉//string A = “Test”; 我搜索但仍然找不到任何东西。

C#Roslyn更改了评论类型

我正在尝试为Visual Studio做一个扩展,它改变了代码中的一些语法。 实际上,我已经完成了第一步,即改变变量的名称,如果这个名称不是我们在公司使用的规则。 例如: int newVariable; double test; 将改为: int iNewVariable; double dblTest; 现在我必须更改此类评论:(SingleLineComment) //this is a single line Comment 进入MultiLineComment /*Here it’s a MultiLine one*/ 我使用Roslyn语法Visualiser来查找生成正确代码的类型和种类,但没有任何作用。 这就是我为Diagnostic做的事情: using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using System.Threading; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; namespace CodeFix { [DiagnosticAnalyzer] [ExportDiagnosticAnalyzer(DiagnosticId, LanguageNames.CSharp)] public class DiagnosticAnalyzer […]

是否有用于评论C#代码的标准(如phpdoc或python的docstring)?

是否有标准约定(如phpdoc或python的docstring)用于注释C#代码,以便可以从源代码自动生成类文档?

.NET // vs ///评论约定

我只是查看F#,如果这是一个愚蠢的问题,请道歉,但在VS2008 F#CTP 1.9.6.2’教程’项目中,//和///都用于评论代码。 两个斜杠与三个斜杠注释之间是否存在function差异,或者是否使用///对函数进行注释(并显示在教程代码中)并使用//用于其他所有内容?

我可以在Visual Studio中刷新XML注释以反映已更改的参数吗?

如果我写这个函数: public static uint FindAUint(double firstParam) { } 我可以通过输入’///’来生成xml注释,它给出: /// /// *Here I type the summary of the method* /// /// *Summary of param* /// *Summary of return* public static uint FindAUint(double firstParam) { } 如果我然后决定我需要更新我的方法: /// /// *Here I type the summary of the method* /// /// *Summary of param* /// *Summary of return* […]

以嵌入方式显示评论,例如Gmail评论

我有一个表comments ,就像这样,添加了一些模型内容: +————+———+———-+——————-+————————————+—————————+ | comment_id | user_id | post_id | comment_parent_id | comment_content | comment_creation_datetime | +————+———+———-+——————-+————————————+—————————+ | 26 | 1 | 16329 | 0 | Första | 2016-01-24 10:42:49 | | 27 | 1 | 16329 | 26 | Svar till första | 2016-01-24 10:42:55 | | 28 | 1 | 16329 | 26 […]

删除C样式多行注释

我有一个C#字符串对象,其中包含generics方法的代码,前面是一些标准的C-Style多行注释。 我想我可以使用System.Text.RegularExpressions删除注释块,但我似乎能够让它工作。 我试过了: code = Regex.Replace(code,@”/\*.*?\*/”,””); 我可以指出正确的方向吗?