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

请回答一个问题。


当前回答

Ctrl+]用于匹配大括号和圆括号。

Ctrl+Shift+]选择括号之间的代码。

其他回答

一个我经常使用但很少有人使用的方法是:

Shift + Alt + F10然后回车

如果你输入一个类名,如Collection<string>,并且没有正确的名称空间导入,那么这个快捷组合将自动插入导入(而斜线符号紧跟在'>'之后)。

更新:

从这个答案的评论中有一个等效的快捷方式(感谢asterite!):

按下Ctrl +。

比我最初推荐的舒服多了。

Ctrl+K, Ctrl+D // Auto-(Re)格式

参见:答案

片段

每个片段都有一个快捷方式,您可以通过输入单词然后按tab键来访问。我用得最多的是标准属性定义;只需输入属性,然后输入制表符。

Ctrl+Shift+8 -返回到之前的“F12/转到定义”

格式的文档

   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.