如何用空格或缩进注释多行

如何用空格或缩进注释多行

本文介绍了如何用空格或缩进注释多行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Visual Studio 2010中,我要注释多行文本:

  A 
B
C

使用 + + 注释掉多行,我得到

  // A 
// B
// C

我想在 // A ,因此 // A 而不是 // A



但是,在将标签分组并缩进一行后, + + 不再注释掉所选文本。



如何对评论进行分组并获得以下内容:

  // A 
// B
// C


解决方案

一种方法是:


  1. 选择文本,按 + ,进行评论( + + )
  2. b $ b
  3. 将光标移到定界符 // 之后和代码文本之前的第一行。

  4. 按 + 并使用箭头键进行选择。 (记住选择行(使用向下,向上箭头键),而不是文本选择-请参见。

    但是在Visual Studio中,注释的默认实现不会插入任何空格


    In Visual Studio 2010, I have multiple lines of text to be commented:

    A
    B
    C
    

    Using ++ to comment out multiple lines, I get

    //A
    //B
    //C
    

    I would like to have a space (or indent) between // and A, hence // A instead of //A.

    However, after I group tab a block of text and indent it, ++ no longer comments out the selected text.

    How to group comment and get the following:

    // A
    // B
    // C
    
    解决方案

    One way to do it would be:

    1. Select the text, Press + , to comment (++ )
    2. Move the cursor to the first line after the delimiter // and before the Code text.
    3. Press + and use arrow keys to make selection. (Remember to make line selection(using down, up arrow keys), not the text selection - See Box Selection and Multi line editing)
    4. Once the selection is done, press space bar to enter a single space.

    Notice the vertical blue line in the below image( that will appear once the selection is made, then you can insert any number of characters in between them)

    I couldn't find a direct way to do that. The interesting thing is that it is mentioned in the C# Coding Conventions (C# Programming Guide) under Commenting Conventions.

    But the default implementation of commenting in visual studio doesn't insert any space

    这篇关于如何用空格或缩进注释多行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 09:18