ReSharper 2020.3 Help

Predefined Live Templates

ReSharper | Tools | Templates Explorer | Live Templates

This section lists all predefined Live templates in ReSharper 2020.3.

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 Live Templates

TemplateDescription
Global
ctxCurrent file context
nguidInsert new GUID
C#
ctxCurrent file context
nguidInsert new GUID
joinJoin clause in language integrated query
fromLanguage-Integrated Query
foreachforeach block
itliIterate a IList<T>
itarIterate an array
ritarIterate an array in inverse order
forSimple "for" loop
sfcSafely cast variable
psvmThe "Main" method declaration
outvPrint value of a variable
outPrint a string
asrtMake an assertion
asrtnAssert expression not null
thrthrow new
pcipublic const int
pcspublic const string
psrpublic static readonly
propProperty
earCreate an empty array
#if (Imported Visual C# Snippets)
#region (Imported Visual C# Snippets)
enum (Imported Visual C# Snippets)
else (Imported Visual C# Snippets)else statement
~ (Imported Visual C# Snippets)Destructor
ctor (Imported Visual C# Snippets)Constructor
cw (Imported Visual C# Snippets)Console.WriteLine
class (Imported Visual C# Snippets)
Exception (Imported Visual C# Snippets)
struct (Imported Visual C# Snippets)
forr (Imported Visual C# Snippets)Reverse 'for' loop
namespace (Imported Visual C# Snippets)
interface (Imported Visual C# Snippets)
sim (Imported Visual C# Snippets)'int Main' method
indexer (Imported Visual C# Snippets)
svm (Imported Visual C# Snippets)'void Main' method
unsafe (Imported Visual C# Snippets)unsafe statement
unchecked (Imported Visual C# Snippets)unchecked block
tryf (Imported Visual C# Snippets)try finally
try (Imported Visual C# Snippets)try catch
switch (Imported Visual C# Snippets)switch statement
while (Imported Visual C# Snippets)while loop
iterator (Imported Visual C# Snippets)simple iterator
propg (Imported Visual C# Snippets)Property with a 'get' accessor and a private 'set' accessor
Attribute (Imported Visual C# Snippets)Attribute using recommended pattern
do (Imported Visual C# Snippets)do...while loop
checked (Imported Visual C# Snippets)checked block
if (Imported Visual C# Snippets)if statement
lock (Imported Visual C# Snippets)lock statement
mbox (Imported Visual C# Snippets)MessageBox.Show
using (Imported Visual C# Snippets)using statement
halASP.NET MVC Html.ActionLink
uaASP.NET MVC Url.Action
rtaASP.NET Controller RedirectToAction
attachedPropertyAttached property
dependencyPropertyDependency property
test
C++
ctxCurrent file context
nguidInsert new GUID
unionunion declaration
wcoutWrite to standard output stream
wclogWrite to standard log stream
cctorCopy constructor declaration with body
wcinRead from standard input stream
ctorDefault constructor declaration with body
UCLASSUCLASS declaration
UENUMCLASSUENUM declaration using the "enum class" syntax
UENUMUENUM declaration
mctorMove constructor declaration with body
vdtorVirtual destructor declaration with body
enum_to_stringFunction 'to_string' for enum
USTRUCTUSTRUCT declaration
dtorDestructor declaration with body
enumclassEnum class declaration
forrReversed for
clogWrite to standard log stream
docDocumentation template
foreachrange-based for loop
wcerrWrite to standard error stream
cerrWrite to standard error stream
cinRead from standard input stream
classClass declaration
coutWrite to standard output stream
dodo while loop
enumEnum declaration
forifor loop pattern with integer index
ifif statement
incgInclude guard
mainmain declaration
namespacenamespace declaration
structstruct declaration
switchswitch statement
trytry catch statement
whilewhile statement
VB.NET
ctxCurrent file context
nguidInsert new GUID
foreachFor Each block
itarIterate an array
itliIterate generic System.Collections.Generic.IList(Of T)
forSimple "For" loop
ritarIterate array in reverse order
DimDeclare a variable
asrtMake an assertion
outPrint a string
outvPrint value of an expression
pssmPublic Shared Sub Main
sfcSafely cast a variable
subSubroutine declaration
funFunction declaration
dcDirectCast clause
tcTryCast clause
ctCType clause
ByRefByRef parameter
ByValByVal parameter
selSelect case statement
attachedPropertyAttached property
dependencyPropertyDependency property
XML
ctxCurrent file context
nguidInsert new GUID
tCreate tag
tcCreate closed tag
aCreate tag attribute
HTML-Like
ctxCurrent file context
nguidInsert new GUID
<scriptCreate script tag
aCreate tag attribute
HTML
ctxCurrent file context
nguidInsert new GUID
<scriptCreate script tag
tCreate tag
tcCreate closed tag
aCreate tag attribute
Razor
ctxCurrent file context
nguidInsert new GUID
<scriptCreate script tag
tCreate tag
tcCreate closed tag
aCreate tag attribute
@inheritsRazor inherits directive
@modelRazor model directive
@sectionRazor section
ASP.NET
ctxCurrent file context
nguidInsert new GUID
<scriptCreate script tag
tCreate ASP.NET tag
tcCreate closed tag
aCreate tag attribute
<asp:HyperLinkASP.NET Hyperlink
foreachforeach block
Angular 2 HTML
ctxCurrent file context
nguidInsert new GUID
<scriptCreate script tag
aCreate tag attribute
ngClass
ngFor
ngIf
ngModel
ngRouterLink
ngStyle
JavaScript
ctxCurrent file context
nguidInsert new GUID
do (Imported JScript Snippets)do...while loop
dw (Imported JScript Snippets)writeln function call
else (Imported JScript Snippets)else statement
for (Imported JScript Snippets)for loop
forin (Imported JScript Snippets)for...in loop
forr (Imported JScript Snippets)reverse for loop
fun Create JavaScript function
function (Imported JScript Snippets)
if (Imported JScript Snippets)if statement
while (Imported JScript Snippets)while loop
with (Imported JScript Snippets)with statement
switch (Imported JScript Snippets)switch statement
try (Imported JScript Snippets)try catch statement
itar Iterate an array
generator (Imported JScript Snippets)generator
forof (Imported JScript Snippets)for-of loop
CSS
ctxCurrent file context
nguidInsert new GUID
TypeScript
ctxCurrent file context
nguidInsert new GUID
do (Imported JScript Snippets)do...while loop
dw (Imported JScript Snippets)writeln function call
else (Imported JScript Snippets)else statement
for (Imported JScript Snippets)for loop
forin (Imported JScript Snippets)for...in loop
forr (Imported JScript Snippets)reverse for loop
fun Create TypeScript function
function (Imported JScript Snippets)
if (Imported JScript Snippets)if statement
while (Imported JScript Snippets)while loop
with (Imported JScript Snippets)with statement
switch (Imported JScript Snippets)switch statement
try (Imported JScript Snippets)try catch statement
itar Iterate an array
forof (Imported JScript Snippets)for-of loop
ctor (Imported TypeScript Snippets) Code snippet for default constructor declaration with body
class (Imported TypeScript Snippets) Code snippet for class
module (Imported TypeScript Snippets) Code snippet for module
interface (Imported TypeScript Snippets) Code snippet for interface
enum (Imported TypeScript Snippets) Code snippet for enum
nidx (Imported TypeScript Snippets) Code snippet for number indexer annotation
sidx (Imported TypeScript Snippets) Code snippet for string indexer annotation
prop (Imported TypeScript Snippets) Code snippet for property
Resx
ctxCurrent file context
nguidInsert new GUID
dCreate resource entry
Last modified: 25 March 2021