自动生成在Visual Studio 2010中的try catch块 [英] Auto-generate a try catch block in visual studio 2010
问题描述
任何人都知道,如果有一个键盘快捷方式或选择自动生成围绕在Visual Studio 2010语句的try / catch块?我可以看到,如果我看的覆盖文件,当我将鼠标悬停在一份声明中抛出什么异常。我想右击 - >生成的try / catch,因为这将节省大量的时间处理所有可能的情况。
这可能吗?
使用鼠标
-
标记您的代码
-
右键单击
-
选择
环绕与...
-
双击
尝试
使用键盘#1
-
使用标记代码<大骨节病>移骨节病>,
<大骨节病>控制骨节病> + <大骨节病> A 骨节病>,或任何你的作品 -
键入<大骨节病>取值骨节病>
-
键入<大骨节病> T 骨节病>
-
按<大骨节病>输入骨节病>或<大骨节病>标签骨节病>
使用键盘#2的(如 perlox 并的弗雷德里克诺林指出)的
-
使用标记代码<大骨节病>移骨节病>,
<大骨节病>控制骨节病> + <大骨节病> A 骨节病>,或任何你 -
按<大骨节病>控制骨节病> + <大骨节病> K 骨节病>,后跟<大骨节病> CTRL 骨节病> + <大骨节病>取值骨节病>
-
键入<大骨节病> T 骨节病>
-
按<大骨节病>输入骨节病>或<大骨节病>标签骨节病>
工作
Anyone know if there is a keystroke shortcut or option to autogenerate a try/catch block around a statement in Visual Studio 2010? I can see what exceptions are thrown if I look at the overlay documentation when I hover over a statement. I'd like to right click -> generate try/catch, as it would save a lot of time in handling all possible cases.
Is this possible?
Using the mouse
Mark your code
Right-click
Select
Surround with...
Double-click
try
Using the keyboard #1
Mark your code using Shift, Ctrl + A, or whatever works for you
Press
Menu key
/Application key
(alternatively Shift + F10)Type S
Type T
Press Enter or Tab
Using the keyboard #2 (as perlox and Fredrik Norlin points out)
Mark your code using Shift, Ctrl + A, or whatever works for you
Press Ctrl + K, followed by CTRL + S
Type T
Press Enter or Tab
这篇关于自动生成在Visual Studio 2010中的try catch块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!