你最喜欢的Visual Studio快捷键是什么?我总是把我的手放在键盘上,远离鼠标!

请回答一个问题。


当前回答

格式的文档

   Ctrl+K, Ctrl+D

On an aspx page, this takes care of properly indenting all of your markup and ensures that everything is XHTML compliant (adds quotes to attributes, corrects capitalization, closes self-closing tags). I find that this makes it much easier to find mismatched tags and to make sure that my markup makes sense. If you don't like how it's indenting, you can control which tags go on their own line and how much space they get around them under Tools/Options/Text Editor/HTML/Format/Tag Specific Options. In your C# or VB code, this will correct any capitalization or formatting issues that didn't get caught automatically. For CSS files, you can choose compact (one definition per line), semi-expanded, or expanded (each rule on its own line); and you can choose how it handles capitalization.

其他回答

“片段”的TAB键。

例如,键入try,然后按tab键两次。

结果:

try 
{           

}
catch (Exception)
{

    throw;
}

然后你可以展开。

完整的c#代码片段列表:http://msdn.microsoft.com/en-us/library/vstudio/z41h7fat.aspx

Ctrl + -和相反的Ctrl + Shift + -。

将光标向后(或向前)移动到它所在的最后一个位置。不再需要向后滚动或PgUp/PgDown来查找您的位置。

这将在Visual Studio中切换打开窗口:

Ctrl + tab和相反的Ctrl + Shift + tab

人们提到过Ctrl+C和Ctrl+V在没有被选择的情况下粘贴一行,但我使用Ctrl+X定期移动代码行。

Ctrl+M, Ctrl+L将展开每一个被折叠的代码。它与Ctrl+M, Ctrl+O相反

我喜欢我的代码干净和安排,所以我最喜欢的快捷键如下:

Ctrl+K,D -格式文档

Ctrl+K,F -格式选定的代码

Ctrl+E,S -显示空白

Ctrl+L -切线

Alt+Enter -插入下面的行