ReSharper 2016.3 Help

Quickly introduce using statements and try...catch blocks

Apart from being able to generate blocks of code with live templates, ReSharper also lets you surround existing code with additional statements, such as try...catch or using statements.

To show the surround menu, simply select the block of code and press Ctrl+Alt+J. This will pop up a menu of available surround statements:

/help/img/dotnet/2016.3/swTryCatch2.png

Now, you can simply start typing the template name. For example, to surround selection with using, you can start typing us... while the pop-up is open. ReSharper will generate the default code stub and allow you to provide values for template parameters:

/help/img/dotnet/2016.3/swTryCatch3.png

See Also

Last modified: 23 January 2017