ReSharper Help

Predefined Surround Templates

ReSharper | Templates Explorer | Surround Templates

This section lists all predefined Surround templates in ReSharper 9.1.

Surround templates let you quickly enclose an expression, a single statement or an arbitrary block of code with a predefined code construction, such as for loop, or try...catch statement. Surround templates have no shortcuts, they are identified by their descriptions. See Surrounding Code Fragments with Templates for details.

Index of Surround Templates

TemplateDescription
C#
namespace Add a namespace to the selected code
if Put the selection into an if statement block
if..else Put the selection into an if statement block and add an else block
while Put the selection into a while loop
for Put the selection into a for loop
do..while Put the selection into a do..while loop
#region Surround the selection with a region
#if..#endif Surround the selection with a pair of preprocessor directives
{} Surround the selection with braces
() Surround the selection with parentheses
try..catch Put the selection into the try block of the try..catch statement
try..finally Put the selection into the try block of the try..finally statement
cast Cast the selection to a specific type
using Put the selection into the using statement
String.Format Integrate the selected format string into the String.Format method call
lock Put the selection into a lock statement
ASP.NET
tag Wrap the selection in a tag
link Wrap the selection in a hyperlink
HTML
tag Wrap the selection in an HTML tag
link Wrap the selection in a hyperlink
Razor
tag Wrap the selection in a tag
link Wrap the selection in a hyperlink
HTML-Like
link
ASP.NET(C#)
foreach foreach block
ASP.NET(VB.NET)
foreach For Each block
JavaScript
{} Surround the selection with braces
() Surround the selection with parentheses
TypeScript
{} Surround the selection with braces
() Surround the selection with parentheses
VB.NET
If Put the selection into the statement block following Then in the If-Then construct
If..Else Put the selection into the statement block following Then in the If-Then-Else construct
SyncLock Transform the selection into the SyncLock statement
Using Put the selection into the Using statement
TryCast Wrap the selection into the TryCast
CType Transform the selection into the first parameter of the CType() function
DirectCast Transform the selection into the first parameter of the DirectCast function.
namespace Add a namespace to the selected code
XML
tag Wrap the selection in a tag
C++
static_cast Surround the selected expression with static_cast
struct Surround selected declarations with struct
dynamic_cast Surround the selected expression with dynamic_cast
#if...#endif
if Put the selection into an if statement block
const_cast Surround the selected expression with const_cast
reinterpret_cast Surround the selected expression with reinterpret_cast
while Put the selection into a while loop
for Put the selection into a for loop
do...while Put the selection into a do..while loop
{} Surround the selection with braces
try...catch Put the selection into the try block of the try..catch statement
cast Cast the selection to a specific type
namespace Add a namespace to the selected code
() Surround the selection with parentheses
class Add a class to the selected code
incg Surround selection with an include guard
if...else Put the selection into an if statement block and add an else block
Last modified: 30 June 2015