ReSharper Help

Predefined Live Templates

ReSharper | Templates Explorer | Live Templates

This section lists all predefined Live templates in ReSharper 9.2.

Live templates represent code fragments that can be quickly inserted into your code. The code of the template can be a short expression, a complete construct, or even an entire class or method. Each live template is identified by a Shortcut - a short string of characters such as foreach - that you can type right in the editor to invoke the template. For more information, see Creating Source Code Using Live Templates.

Index of Live Templates

TemplateDescription
Global
ctx Current file context
nguid Insert new GUID
C#
Predefined Live Templates for C#
ctx Current file context
join Join clause in language integrated query
from Language-Integrated Query
foreach foreach block
itdic Iterate a Dictionary
itdg Iterate a Dictionary<K, V>
itli Iterate a IList<T>
itar Iterate an array
ital Iterate an ArrayList
ritar Iterate an array in inverse order
for Simple "for" loop
toar Convert an ArrayList to array
sfc Safely cast variable
psvm The "Main" method declaration
outv Print value of a variable
out Print a string
asrt Make an assertion
asrtn Assert expression not null
thr throw new
pci public const int
pcs public const string
psr public static readonly
prop Property
ear Create an empty array
nguid Insert new GUID
#if (Imported Visual C# Snippets)Code snippet for #if
#region (Imported Visual C# Snippets)Code snippet for #region
enum (Imported Visual C# Snippets)Code snippet for enum
else (Imported Visual C# Snippets)Code snippet for else statement
~ (Imported Visual C# Snippets)Code snippet for destructor
ctor (Imported Visual C# Snippets)Code snippet for constructor
cw (Imported Visual C# Snippets)Code snippet for Console.WriteLine
class (Imported Visual C# Snippets)Code snippet for class
Exception (Imported Visual C# Snippets)Code snippet for exception
equals (Imported Visual C# Snippets)Code snippet for implementing Equals() according to guidelines
struct (Imported Visual C# Snippets)Code snippet for struct
invoke (Imported Visual C# Snippets)Code snippet for safely invoking an event
forr (Imported Visual C# Snippets)Code snippet for reverse 'for' loop
namespace (Imported Visual C# Snippets)Code snippet for namespace
interface (Imported Visual C# Snippets)Code snippet for interface
sim (Imported Visual C# Snippets)Code snippet for int Main()
indexer (Imported Visual C# Snippets)Code snippet for indexer
svm (Imported Visual C# Snippets)Code snippet for 'void Main' method
unsafe (Imported Visual C# Snippets)Code snippet for unsafe statement
unchecked (Imported Visual C# Snippets)Code snippet for unchecked block
tryf (Imported Visual C# Snippets)Code snippet for try finally
try (Imported Visual C# Snippets)Code snippet for try catch
switch (Imported Visual C# Snippets)Code snippet for switch statement
while (Imported Visual C# Snippets)Code snippet for while loop
iterator (Imported Visual C# Snippets)Code snippet for a simple iterator
propg (Imported Visual C# Snippets)Code snippet for an automatically implemented property with a 'get' accessor and a private 'set' accessor
Attribute (Imported Visual C# Snippets)Code snippet for attribute using recommended pattern
do (Imported Visual C# Snippets)Code snippet for do...while loop
checked (Imported Visual C# Snippets)Code snippet for checked block
if (Imported Visual C# Snippets)Code snippet for if statement
lock (Imported Visual C# Snippets)Code snippet for lock statement
mbox (Imported Visual C# Snippets)Code snippet for MessageBox.Show
iterindex (Imported Visual C# Snippets)Code snippet for 'named' iterator/indexer pair using a nested class
using (Imported Visual C# Snippets)Code snippet for using statement
hal ASP.NET MVC Html.ActionLink
ua ASP.NET MVC Url.Action
rta ASP.NET Controller RedirectToAction
attachedProperty Attached property
dependencyProperty Dependency property
C++
Predefined Live Templates for C++
ctx Current file context
nguid Insert new GUID
unn Code snippet for new union declaration
wcout Code snippet for writing to standard output stream
wclog Code snippet for writing to standard log stream
wcin Code snippet for reading from standard input stream
ctor Code snippet for default constructor declaration with body
vdtor Code snippet for virtual destructor declaration with body
dtor Code snippet for destructor declaration with body
enumclass Code snippet for new enum class declaration
clog Code snippet for writing to standard log stream
wcerr Code snippet for writing to standard error stream
cerr Code snippet for writing to standard error stream
cin Code snippet for reading from standard input stream
cls Code snippet for new class declaration
cout Code snippet for writing to standard output stream
do Code snippet for do-while loop
else Code snippet for 'else' statement
enm Code snippet for new enum declaration
foreach Code snippet for 'range-based for' loop
fori Code snippet for common 'for' loop pattern with integer index
forr Code snippet for common 'for' loop pattern with integer index and reversed iteration order
if Code snippet for 'if' statement
incg Code snippet for include guard
main Code snippet for main declaration
ns Code snippet for namespace decalration
str Code snippet for new struct declaration
switch Code snippet for switch statement
try Code snippet for try catch
while Code snippet for 'while' statement
VB.NET
Predefined Live Templates for VB.NET
ctx Current file context
foreach For Each block
itar Iterate an array
itdg Iterate generic dictionary System.Collections.IDictionary(Of K, V)
itli Iterate generic System.Collections.Generic.IList(Of T)
for Simple "For" loop
ritar Iterate array in reverse order
Dim Declare a variable
asrt Make an assertion
out Print a string
outv Print value of an expression
pssm Public Shared Sub Main
sfc Safely cast a variable
sub Subroutine declaration
fun Function declaration
dc DirectCast clause
tc TryCast clause
ct CType clause
ByRef ByRef parameter
ByVal ByVal parameter
sel Select case statement
nguid Insert new GUID
attachedProperty Attached property
dependencyProperty Dependency property
XML
Predefined Live Templates for XML
ctx Current file context
t Create tag
tc Create closed tag
a Create tag attribute
nguid Insert new GUID
HTML-Like
Predefined Live Templates for HTML-Like Files
ctx Current file context
nguid Insert new GUID
<script Create script tag
a Create tag attribute
HTML
Predefined Live Templates for HTML
ctx Current file context
nguid Insert new GUID
<script Create script tag
t Create tag
tc Create closed tag
a Create tag attribute
ASP.NET
Predefined Live Templates for ASP.NET
ctx Current file context
nguid Insert new GUID
<script Create script tag
t Create ASP.NET tag
tc Create closed tag
a Create tag attribute
<asp:HyperLink ASP.NET Hyperlink
Razor
Predefined Live Templates for Razor
ctx Current file context
nguid Insert new GUID
<script Create script tag
t Create tag
tc Create closed tag
a Create tag attribute
@inherits Razor inherits directive
@model Razor model directive
@section Razor section
CSS
Predefined Live Templates for CSS
ctx Current file context
nguid Insert new GUID
JavaScript
Predefined Live Templates for JavaScript
ctx Current file context
nguid Insert new GUID
do (Imported JScript Snippets)Code snippet for do...while loop
dw (Imported JScript Snippets)Code snippet for a writeln function call
else (Imported JScript Snippets)Code snippet for an else statement
for (Imported JScript Snippets)Code snippet for a for loop
for (Imported JScript Snippets)Code snippet for a for loop
forin (Imported JScript Snippets)Code snippet for a for...in loop
forin (Imported JScript Snippets)Code snippet for a for...in loop
forr (Imported JScript Snippets)Code snippet for a reverse for loop
forr (Imported JScript Snippets)Code snippet for a reverse for loop
fun Create JavaScript function
function (Imported JScript Snippets)Code snippet for a function
if (Imported JScript Snippets)Code snippet for an if statement
while (Imported JScript Snippets)Code snippet for a while loop
with (Imported JScript Snippets)Code snippet for a with statement
switch (Imported JScript Snippets)Code snippet for a switch statement
try (Imported JScript Snippets)Code snippet for a try catch statement
itar Iterate an array
generator (Imported JScript Snippets)Code snippet for a generator
forof (Imported JScript Snippets)Code snippet for a for-of loop
TypeScript
Predefined Live Templates for TypeScript
ctx Current file context
nguid Insert new GUID
do (Imported JScript Snippets)Code snippet for do...while loop
dw (Imported JScript Snippets)Code snippet for a writeln function call
else (Imported JScript Snippets)Code snippet for an else statement
for (Imported JScript Snippets)Code snippet for a for loop
forin (Imported JScript Snippets)Code snippet for a for...in loop
forr (Imported JScript Snippets)Code snippet for a reverse for loop
fun Create TypeScript function
function (Imported JScript Snippets)Code snippet for a function
if (Imported JScript Snippets)Code snippet for an if statement
while (Imported JScript Snippets)Code snippet for a while loop
with (Imported JScript Snippets)Code snippet for a with statement
switch (Imported JScript Snippets)Code snippet for a switch statement
try (Imported JScript Snippets)Code snippet for a try catch statement
itar Iterate an array
forof (Imported JScript Snippets)Code snippet for a 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
Predefined Live Templates for Resx
ctx Current file context
nguid Insert new GUID
d Create resource entry
Last modified: 27 August 2015