ReSharper Web Help

ReSharper Help: Live Templates

ASP.NET

<a Inserts HTML hyperlink.
<asp:HyperLink Inserts ASP.NET hyperlink control.
<script Inserts script block which contains some code.
a Displays the list of attributes which are available in the current tag and inserts chosen one.
t Displays the list of tags which are available at current place and inserts chosen one.
tc Displays the list of tags which are available at current place and inserts single closed tag.

C#

Imported Visual C# Snippets

34 Visual Studio code snippets imported into ReSharper as live templates. See Inserting Imported Code Snippets with ReSharper and MSDN: Code Snippets (C#) for details.

Iteration

for Creates a general-purpose for loop.
foreach Generates a foreach block which iterates over an instance of System.Collections.IEnumerable.
ital Generates a forloop which iterates over an instance ofSystem.Collections.ArrayList. Includes a customizable statement in the loop body with a variable to hold a current array element.
itar Generates a for loop for iterating over an array. Includes a customizable statement in the loop body with a variable to hold a current array element.
itdg Generates a foreach block which iterates over a System.Collections.Generic.IDictionary collection. Includes two customizable statements in the loop body with two variables holding the key and the value of a dictionary element.
itdic Generates a foreach block which iterates over a System.Collections.IDictionary collection. Unlike itdg, it provides fully-qualified type name for iterator variable in the loop condition and performs type casts over the key and the value of a dictionary element in the loop body. Includes two customizable statements in the loop body with two variables holding the key and the value of a dictionary element.
itli Generates a for loop which iterates over an instance of System.Collections.IList. Includes a customizable statement in the loop body with a variable holding container elements.
ritar Generates a for loop for iterating over an array. Includes a customizable statement in the loop body with a variable to hold a current array element.

Other

asrt This template calls the Debug.Assert method, which is used for debugging purposes. After the template expanded, the caret moves between the parentheses so that you can specify a condition.
ear Generates a code fragment that creates an empty array.
from Starts a LINQ query.
hal Inserts the ActionLink() method call within ASP.NET MVC view.
join Refers to an secondary collection in a LINQ query.
out Outputs a string.
outv Outputs the value of a variable defined in the current scope.
pci Declares an integer constant.
pcs Declares a constant string.
prop Generates an auto-property.
psr Generates a static read-only field.
psvm Generates the Main() application method.
rta Inserts the RedirectToAction() method call in ASP.NET MVC controller.
sfc Generates a code construct to cast variables in a safe manner.
thr Throws an exception.
toar Generates a code fragment that copies the elements of System.Collections.ArrayList to an array using the ToArray() method.
ua Inserts the Action() method call in ASP.NET MVC view or controller.

Resx

d Creates a new data element. Each data element contains a name and a value.

VB.NET

Iteration

for Generates a For loop which iterates until its loop index variable reaches a specified maximum value.
foreach Generates a For Each block which iterates over an instance of System.Collections.IEnumerable.
itar Generates a For loop for iterating over an array.
itdg Generates a For Each block which iterates over a System.Collections.IDictionary collection. Includes two customizable statements in the loop body with two variables holding the key and the value of a dictionary element.
itli Generates a For loop which iterates over an instance of System.Collections.IList.
ritar Generates a For loop for iterating over an array in reverse order.

Other

asrt This template calls the System.Diagnostics.Debug.Assert() method, which is used for debugging purposes. After the template expanded, the caret moves between the parentheses so that you can specify a condition.
ct Generates the CType() function, which is used to explicitly convert VB.NET types.
dc Generates the DirectCast() function as an alternative way to perform type casts.
dim Declares a new variable.
fun Declares a new function.
out Outputs a string.
outv Outputs value of an expression.
pssm Generates the Main() method for a VB.NET application.
sfc Casts a variable in a safe manner, checking for null reference.
sub Declares a new subroutine.
tc Performs a cast that doesn't throw exceptions.

XML

a Creates a new tag attribute.
t Creates a new pair, which consists of an opening tag and a closing tag.
tc Creates a single closed tag.

No Language

defaultBodyTemplate This template has been superseded by a new page in the ReSharper Options dialog box, ReSharper | Options | Languages | Common | Members Generation.
ctx Provides the list of items that describe the current context.
nguid Inserts a globally unique identifier.

ReSharper Help: Surround Templates

ASP.NET

C#

foreach Puts a selection into a foreach statement block.

VB.NET

foreach Puts a selection into a foreach statement block.

Other

link Wraps selection with a tag.
tag Displays the list of available tags and wraps selection with a pair of tags.

C#

#if..#endif Delimits a selection with a pair of preprocessor directives.
#region Surrounds a selection with a region.
() Surrounds a selection with a pair of parentheses.
{} Surrounds a selection with a pair of braces.
cast Casts a selection to a specified type.
do..while Puts a selection into a do..while statement block.
for Puts a selection into a for statement block.
if Puts a selection into an if statement block.
if..else Integrates a selection into the if statement block of an if..else conditional statement.
lock Integrates a selection into a lock statement.
namespace Adds a namespace to selected code.
String.Format Integrates a selected format string into a String.Format method call.
try..catch Puts a selection into the try block of a try..catch statement.
try..finally Puts a selection into the try block of a try..finally statement.
using Puts a selection into a using statement.
while Puts a selection into a while statement block.

VB.NET

CType Transforms selection into the first parameter of the CType() function, which is used to explicitly convert VB.NET types.
DirectCast Transforms selection into the first parameter of the DirectCast function as an alternative way to perform type casts.
If Puts selection into the statement block following Then in an If-Then construct.
If..Else Puts selection into the statement block following Then in an If-Then-Else construct.
namespace Wraps selection into a namespace.
SyncLock Transforms selection into the statement block of a SyncLock statement.
TryCast Wraps selection with a cast expression that doesn't throw exceptions.
Using Puts selection into a using statement.

XML

tag Wraps selection with a pair of tags.

ReSharper Help: File Templates

ASP.NET (C#)

Master page with base master page Creates a new ASP.NET child master page.
Master page without base master page Creates a new ASP.NET master page.
Web control Creates ASP.NET user control.
Web form with master page Creates ASP.NET Web page.
Web form without master page Creates ASP.NET Web page without master page.

ASP.NET (VB.NET)

Master page with base master page Creates a new ASP.NET child master page.
Master page without base master page Creates a new ASP.NET master page.
Web control Creates ASP.NET user control.
Web form with master page Creates ASP.NET Web page.
Web form without master page Creates ASP.NET Web page without master page.

C#

Class Creates a new file in the current project containing an empty class.
Enum Creates a new file in the current project containing an empty enumeration.
Interface Creates a new file in the current project containing an empty interface.
Struct Creates a new file in the current project containing an empty struct.

VB.NET

Class Creates a new file in the current project containing an empty class.
Enum Creates a new file in the current project containing an empty enumeration.
Interface Creates a new file in the current project containing an empty interface.
Module Creates a new file in the current project containing an empty module.
Structure Creates a new file in the current project containing an empty structure.

See Also

Procedures

Reference

External Links