ReSharper 2021.2 Help

Predefined Surround Templates

ReSharper | Tools | Templates Explorer | Surround Templates

This topic lists all predefined Surround templates in ReSharper 2021.2.

Live/Surround templates can be used for generating code in existing files and (if there is the $SELECTION$ parameter in the template body) for surrounding code fragments with template code, such as try...catch statement.
Each live template is identified by a Shortcut — a short string of characters, for example foreach — that you can type right in the editor to invoke the template.

Index of Surround Templates

TemplateDescription
C#
() Surround the selection with parentheses
{} Surround the selection with braces
foreachforeach block
forSimple "for" loop
#if
#region Surround the selection with a region
namespace Add a namespace to the selected code
tryftry finally
trytry catch
whilewhile loop
dodo...while loop
ifif statement
locklock statement
usingusing statement
cast Cast the selection to a specific type
XML
tag
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
tc Wrap the selection into the TryCast
ct Transform the selection into the first parameter of the CType() function
dc Transform the selection into the first parameter of the DirectCast function.
namespace Add a namespace to the selected code
JavaScript
{} Surround the selection with braces
() Surround the selection with parentheses
TypeScript
{} Surround the selection with braces
() Surround the selection with parentheses
ASP.NET
tag
link Wrap the selection in a hyperlink
HTML
tag
link Wrap the selection in a hyperlink
Razor
tag
link Wrap the selection in a hyperlink
HTML-Like
link Wrap the selection in a hyperlink
Angular 2 HTML
link
ASP.NET(C#)
foreachforeach block
ASP.NET(VB.NET)
foreachFor Each block
C++
forrReversed for
foreachrange-based for loop
dodo while loop
forifor loop pattern with integer index
ifif statement
trytry catch statement
whilewhile statement
static_caststatic_cast expression
dynamic_castdynamic_cast expression
namespaceAnonymous namespace declaration
#if...#endif Code snippet for #if...#endif preprocessor directive
const_castconst_cast expression
reinterpret_castreinterpret_cast expression
castC-like cast expression
namespace ...namespace declaration
if...elseif else statement
Last modified: 12 July 2021