Indentation shortcuts in Visual Studio

后端 未结 8 2154
不知归路
不知归路 2021-01-29 18:16

I\'m new to Visual Studio 2010 and C#. How can I indent the selected text to left/right by using shortcuts?

\"enter

8条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-29 18:59

    Ctrl-K, Ctrl-D

    Will just prettify the entire document. Saves a lot of messing about, compared to delphi.

    Make sure to remove all indents by first selecting everything with Ctrl+A then press Shift+Tab repeatedly until everything is aligned to the left. After you do that Ctrl+K, Ctrl+D will work the way you want them to.

    You could also do the same but only to a selection of code by highlighting the block of code you want to realign, aligning it to the left side (Shift+Tab) and then after making sure you've selected the code you want to realign press Ctrl+K, Ctrl+F or just right click the highlighted code and select "Format Selection".

提交回复
热议问题