ReSharper 2024.2 Help

Context actions for Visual Basic

ReSharper provides the following context actions for VB.NET:

Name

Description

Add new argument to interpolation

Adds new argument to interpolation and converts string to interpolation if necessary

Add new format item

Adds new format item to format string and new argument to Format method invocation

For more information, refer to code analysis and helpers for string literals.

Add other accessor(s)

Adds missing accessor to a property or any missing accessors to an event.

Annotate with 'value can be null' attribute

Annotates with 'value can be null' attribute. The attribute can be configured via external annotations.

For more information, refer to using context actions to add annotation attributes.

Annotate with 'value cannot be null' attribute

Annotates with 'value cannot be null' attribute. The attribute can be configured via external annotations.

For more information, refer to using context actions to add annotation attributes.

Change member visibility

Available on an access modifier keyword and allows changing access rights of a declaration.

Convert 'For Each' to 'For' on variable loop

Works on 'For Each' statements executed on a collection that allows direct access to its elements by index. It converts such 'For Each' statement to 'For' on variable statement.

Convert 'Function' to 'Sub'

Converts 'Function' to 'Sub' removing 'As' clause.

Convert 'If' statement to 'Select Case' statement

Works on 'If' statement that compares value of an expression with one or more constants. It converts such 'If' statement into a 'Select Case' statement.

Convert iterator to method

Converts iterator to method or property with List<T> fill or array return

Convert 'Sub' to 'Function'

Converts 'Sub' to 'Function' adding 'As' clause.

Convert to implicitly typed local variable declaration

Converts local variable declaration to implicitly typed declaration.

Convert to string interpolation

Converts regular string to interpolation.

Convert to string interpolation

Converts string.Format call to string interpolation even in case that could change control flow.

Create overload without parameter

Creates overload without given parameter. Invokes current member.

Implement abstract member

Works on an interface member or an abstract member. Searches for classes where this member needs to be implemented and allows implementing it in one of them.

Implement virtual member

Works on a virtual member. Searches for classes where this member can be implemented and allows implementing it in one or all of them.

Initialize auto-property from constructor parameter

Optionally creates and initializes auto-property from constructor parameter

Initialize field from constructor parameter

Optionally creates and initializes field from constructor parameter

Insert inferred type arguments

Inserts method's inferred type arguments.

Introduce variable from expression statement

Introduces variable from expression statement

Invert 'If' statement

Inverts guard condition of an 'If' statement and swaps the branches' code accordingly.

Iterate via 'For Each'

Works on an expression of System.ICollection type or other expression whose value can be iterated with 'foreach' statement. Generates a 'For Each' 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.

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.

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.

Remove format item

Removes format string item and proper formatting method argument

For more information, refer to code analysis and helpers for string literals.

Replace auto-property with backing field

Replaces auto-property with property that utilizes backing field.

For more information, refer to use auto-properties

Replace backing field with auto-property

Replaces property that utilizes backing field with auto-property.

For more information, refer to use auto-properties

Reverse assignment statement

Reverses source and destination parts of an assignment statement.

Specify type in local variable declaration

Explicitly specifies type in implicitly typed local variable declaration.

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 local variable declaration and assignment

Moves variable initializer from declaration statement to separate assignment statement.

Split string literal

Splits string literal into two literals.

Splits 'If' statement to nested statements

Works on 'If' statement whose condition is conjunction ('AndAlso') of two simpler conditions. It converts such 'If' statement into two nested 'If' statements.

Surround with format

Surrounds string with String.Format() call.

Surround with 'With'

Surrounds block with 'With' construct.

Use format string

Converts concatenation of a few strings and other objects to the use of string.Format method.

For more information, refer to code analysis and helpers for string literals.

Use string interpolation

Converts concatenation of a few strings and other objects to the use of string interpolation.

Last modified: 11 February 2024