Predefined Surround Templates
This section lists all predefined Surround templates in ReSharper 2017.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, e.g. foreach — that you can type right in the editor to invoke the template.
Index of Surround Templates
Template | Description |
---|---|
C++ | |
() | Surround the selection with parentheses |
{} | Surround the selection with braces |
forr | Code snippet for common 'for' loop pattern with integer index and reversed iteration order |
foreach | Code snippet for 'range-based for' loop |
do | Code snippet for do-while loop |
fori | Code snippet for common 'for' loop pattern with integer index |
if | Code snippet for 'if' statement |
try | Code snippet for try...catch statement |
while | Code snippet for 'while' statement |
static_cast | Surround the selected expression with static_cast |
struct | Surround selected declarations with struct |
dynamic_cast | Surround the selected expression with dynamic_cast |
namespace | Add a namespace to the selected code |
#if...#endif | Code snippet for #if...#endif preprocessor directive |
const_cast | Surround the selected expression with const_cast |
reinterpret_cast | Surround the selected expression with reinterpret_cast |
cast | Cast the selection to a specific type |
namespace ... | namespace ... |
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 |
C# | |
() | Surround the selection with parentheses |
{} | Surround the selection with braces |
foreach | foreach block |
for | Simple "for" loop |
#if (Imported Visual C# Snippets) | Code snippet for #if |
#region (Imported Visual C# Snippets) | Code snippet for #region |
namespace (Imported Visual C# Snippets) | Code snippet for namespace |
tryf (Imported Visual C# Snippets) | Code snippet for try finally |
try (Imported Visual C# Snippets) | Code snippet for try catch |
while (Imported Visual C# Snippets) | Code snippet for while loop |
do (Imported Visual C# Snippets) | Code snippet for do...while loop |
if (Imported Visual C# Snippets) | Code snippet for if statement |
lock (Imported Visual C# Snippets) | Code snippet for lock statement |
using (Imported Visual C# Snippets) | Code snippet for using statement |
cast | Cast the selection to a specific type |
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#) | |
foreach | foreach block |
ASP.NET(VB.NET) | |
foreach | For Each block |
TypeScript | |
{} | Surround the selection with braces |
() | Surround the selection with parentheses |
JavaScript | |
{} | Surround the selection with braces |
() | Surround the selection with parentheses |
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 |