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?
Mark your code
Right-click
Select Surround with...
Double-click try
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
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