相关疑难解决方法(0)

为什么 Visual Studio 在使用“评论选择”评论多行选择时诉诸单行评论?

关于Visual Studio 中的注释选择选项,我一直想知道的一些小事(Ctrl+ KCtrl+ C)。

当我评论这个方法的实现时,使用单行注释格式。

private void Foo()
{
    //Bar b = new Bar();
}
Run Code Online (Sandbox Code Playgroud)

当我在这里(部分行)对构造函数的参数进行注释时,使用了分隔注释格式。

private void Foo(Qux q)
{
    Bar b = new Bar(/*q*/);
}
Run Code Online (Sandbox Code Playgroud)

注释掉整个方法会导致:

//private void Foo()
//{
//    Bar b = new Bar();
//}
Run Code Online (Sandbox Code Playgroud)

我觉得分隔注释格式在最后一种情况下更合适,因为规范说:

单行注释延伸到源代码行的末尾。分隔注释可能跨越多行。

有谁知道为什么在 Visual Studio 中评论多行选择时将其选为默认格式?

.net c# comments visual-studio

4
推荐指数
1
解决办法
1389
查看次数

标签 统计

.net ×1

c# ×1

comments ×1

visual-studio ×1