By selecting or clearing check boxes in this page, you can compile the list of Context Actions that will be available for your code. When you select a specific context action, you can read its description in the lower part of the tab.
| Name | Description |
|---|---|
|
Add another accessor |
Adds second accessor to an event or property. |
|
Add exception xml comment tag |
Adds exception xml comment tag. |
|
Add explicit name of anonymous property |
Adds explicit name specification to anonymous type property declaration. |
|
Annotate method with 'value can be null' attribute | Annotates a method with 'value can be null' attribute. The attribute can be configured via code annotations. |
|
Apply refactoring |
Applies refactoring. |
|
'catch' to 'catch(Exception)' |
Converts catch to catch(System.Exception). |
|
'catch(Exception)' to 'catch' |
Converts catch(System.Exception) to catch. |
|
Change member visibility |
Available on an access modifier keyword and allows changing access rights of a declaration. |
|
Check array index value |
Checks index value for arrays. |
|
Check collection index value |
Checks index value for collections and lists. |
|
Check dictionary key value |
Checks key value for dictionaries. |
|
Check if parameter is null |
Checks function parameter for null. |
|
Check if reference is not null |
Puts the current statement under an if statement that performs null reference check for a variable at the caret. |
|
Check if variable is null |
Checks if variable is null. |
|
Check string index value |
Checks index value for strings. |
|
Check StringBuilder index value |
Checks index value for the StringBuilder. |
|
Compute constant value |
Computes value of the current expression and replace it (e.g. 1 + 1 replaced by 2). |
|
Concatenate string |
Converts concatenation of a few strings and other objects to the use of string.Format method. |
|
Convert '==' to 'Equals' |
Converts usage of equality operator (==) to a call to object.Equals method. |
|
Convert anonymous method to lambda |
Converts anonymous method to lambda. |
|
Convert coalescing operator to ternary |
Converts null coalescing operator to ternary conditional operator. |
|
Convert 'Equals' to '==' operator |
Converts a call to the static object.Equals method into usage of equality (==) or inequality (!=) operator. |
|
Convert explicit to implicit implementation |
Converts explicit implementation of an interface method to implicit implementation. |
|
Convert 'foreach' to 'for' loop |
Works on foreach statements executed on a collection that allows direct access to its elements by index. It converts such foreach statements to for statements. |
|
Convert 'if' statement to 'switch' statement |
Works on if statements that compare value of an expression with one or more constants. It converts such if statements into a single switch statement. |
|
Convert 'if' statement to ternary expression |
Works on if statement that returns value or performs assignment inside each branch. It converts the statement to a ternary expression (x ? a : b) |
|
Convert implicit to explicit interface implementation |
Converts implicit implementation of an interface member to explicit implementation. |
|
Convert instance 'Equals' to static 'Equals' |
Converts a call to instance Equals method into usage of equality (==) or inequality (!=) operator. |
|
Convert lambda body with single return statement to expression |
Converts return statement of lambda body to expression. |
|
Convert lambda expression body to body with single return statement |
Converts expression of lambda body to return statement. |
|
Convert lambda to anonymous delegate |
Converts lambda to anonymous method. |
|
Convert LINQ to methods chain |
Converts LINQ query to extension methods call. |
|
Convert method group to anonymous method |
Converts method group to anonymous method. |
|
Convert method group to lambda |
Converts method group to lambda expression. |
|
Convert 'switch' statement to 'if' statement |
Converts switch statements into one or multiple nested if statements each checking for individual value. |
|
Convert ternary expression to 'if' statement |
Converts ternary expression whose value is returned or assigned to an if statement. |
|
Convert ternary to coalescing operator |
Converts ternary conditional operator comparing value with null to coalescing operator. |
|
Convert to dec |
Converts numeric value from hexadecimal to decimal. |
|
Convert to hex |
Converts numeric value from decimal to hexadecimal. |
|
Convert to regular string |
Converts verbatim string @"" to regular string "". |
|
Convert to verbatim string |
Converts regular string "" to verbatim string @"". |
|
Copy comments from base |
Copies comments from base to overriding members/types. |
|
Create derived type |
Creates class that implements interface or inherits class. |
|
Create event invocator |
Creates an event invocator. |
|
Create overload without parameter |
Creates overload without given parameter. Calls current method. |
|
Create return from expression statement |
Creates a return statement with value that is taken as an expression statement. |
|
Extract anonymous method to method of the containing type |
Extracts anonymous method as a private method of the containing type. |
|
Flip an invocation expression |
Flips the current invocation expression e.g. left.Equals(right) to right.Equals(left). |
|
Flip an operator arguments |
Flips left and right arguments for selected operator e.g. null == list to list == null. |
|
Flip an relational expression |
Flips the current relational expression e.g. list.Cont > 1 to list.Cont < 1. |
|
Implement abstract member |
Works on an interface member or an abstract member. Searches for classes where this member needs to be implemented and allows to implement it in one of them. |
|
Implement custom event accessors |
Adds placeholders for custom implementation of add and remove methods for an event. |
|
Initialize auto property from constructor parameter |
Optionally creates and initializes an auto property from constructor parameter. |
|
Initialize field from constructor parameter |
Optionally creates and initializes field from a constructor parameter. |
|
Inline as anonymous type action |
Replaces usages of the type in the method with anonymous type usages. |
|
Insert anonymous method signature |
Adds proper signature to parameterless declaration of an anonymous method. |
|
Introduce variable from expression statement |
Introduces a variable from expression statement. |
|
Invert 'if' statement |
Inverts guard condition of an if statement and swaps code in branches appropriately. |
|
Invert ternary condition |
Inverts condition and swaps branches of a ternary expression. |
|
Invoke as static method |
Changes invocation syntax from extension method to static method. |
|
Iterate via 'foreach' |
Works on an expression of System.ICollection type or other expression whose value can be iterated with foreach statement. Generates a foreach statement iterating the expression. |
|
Join local variable declaration and assignment |
Works on an assignment to a variable that was declared without initializer. Moves the declaration to the current point and merges it with the assignment. |
|
Join string literals |
Concatenates two string literals into one. |
|
Make abstract member virtual |
Makes abstract member virtual. |
|
Make method partial |
Converts private void method to partial method defining declaration. |
|
Match file name with type name |
Renames current file to match the name of the only top-level type declared therein. |
|
Merge nested 'if' statements |
Merges two nested if statements to a single if statement that checks conjunction of the original conditions. |
|
Merge partial method declarations |
Merges all declarations of a partial method into single declaration. |
|
Merge partial type declarations |
Merges all declarations of a partial type into single declaration. |
|
Move declaration(s) to another type part |
Moves selected declarations range or a single declaration (if invoked without selection on a declaration name) to another type part of a partial type. |
|
Move initialization to constructor(s) |
Works on fields initialized in the declaration. It moves the initialization to constructors. |
|
Move to outer scope |
Moves variable to outer scope. |
|
Move type to another file to match its name |
Moves current type to another file so that its name matches the name of the type. |
|
Negate an relational expression |
Negates the current relational expression e.g. list.Cont > 1 to list.Cont <= 1. |
|
Override virtual member |
Works on a virtual member. Searches for classes where this member can be overridden and allows to override it in one or all of them. |
|
Put inside 'using' construct |
Converts variable declaration of type that implements the System.IDisposable interface into using statement. This is useful for enforcing lifetime for disposable objects. |
|
Remove #region, #endregion directives |
Removes region and corresponding endregion pair of directives. |
|
Remove braces |
Removes unnecessary braces around one or more statements in the code. |
|
Replace ArrayList with List<T> |
Replaces ArrayList type of a local variable with generic List<T> type where T is guessed |
|
Replace auto property with backing field |
Replaces auto property with property that utilizes backing field. |
|
Replace backing field with auto property |
Replaces property that utilizes backing field with auto property. |
|
Replace explicit type specification with 'var' |
Replaces explicit type declaration with var. |
|
Replace 'var' with explicit type declaration |
Replaces var with explicit type declaration. |
|
Reverse assignment statement |
Reverses source and destination parts of an assignment statement. |
|
Specify array type explicitly |
Adds explicit type specification to array creation expression. |
|
Split declaration list |
Works on variable declaration statement that declares multiple variables. It splits such statement into multiple statements each declaring a single variable. |
|
Split 'if' with '&&'-condition into nested 'if'-statements |
Works on an if statement, where condition is a conjunction (&&) of two simpler conditions. It converts the if statement into two nested if statements. |
|
Split 'if' with '||'-condition into assignment to temporary variable and two 'if'-statements |
Works on an if statement, where condition is a disjunction (||) of two simpler conditions. It converts the if statement into an assignment to a temporary variable and an two if statements. |
|
Split local variable declaration and assignment |
Moves variable initializer from declaration statement to separate assignment statement. |
|
Split 'return' with '&&'-condition into guarding 'if' and 'return' |
Works on a return statement, which condition is a conjunction (&&) of two simpler conditions. It converts the return statement into a guarding if statement and a return. |
|
Split 'return' with '||'-condition into assignment to temporary variable, 'if'-statement and 'return' |
Works on a return statement, which condition is a disjunction (||) of two simpler conditions. It converts the return statement into an assignment to a temporary variable, if statement and return statement. |
|
Split string literal |
Splits string literal into two literals. |
|
Split variable into several ones |
Replaces original variable with several ones declared in inner blocks of the current block. |
|
Surround with "" |
Creates string literal of selection text. |
|
Surround with format |
Surrounds a string with string.Format() call. |
|
To assignment statements |
Replaces initializer with a series of assignments. |
|
Use Add() method calls |
Replaces a collection or collection element initializer with a series of Add() method calls. |
|
Use 'as' and check for null |
Converts if(a is B) {} to var b = a as B; if(b != null) {} and updates usages. |
|
Use collection initializer |
Replaces a series of Add() method calls with collection initializer. |
|
Use object initializer |
Replaces a series of assignments with an object initializer. |
|
Use System.Environment.NewLine |
Replaces literals \n, \r or \r\n with System.Environment.NewLine property. |
|
Use System.String.Empty |
Replaces "" literal with String.Empty field. |
Note
ReSharper's settings are saved in settings layers that enable you to have different settings for different solutions as well as to share your settings with your team. To learn more, study the Managing and Sharing Options section.

