JetBrains Rider 2021.3 Help

Context actions for C#

JetBrains Rider provides the following context actions for C#:

Name

Description

Add <exception> tag to XML documentation

Add <exception> tag to XML documentation.

Add <inheritdoc /> tag to XML documentation

Adds <inheritdoc /> so that the XML documentation is inherited from the base candidate

Add another accessor

Adds second accessor to an event or a property

Add block braces to switch section statements

Adds braces to switch section statements

Add braces

Adds braces to statement

Add deconstruct pattern component name

Adds explicit deconstruction pattern component name based on names in source pattern dispatch type.

Add deconstruct pattern component name

Adds explicit deconstruction pattern component name based on names in source pattern dispatch type.

Add explicit name of anonymous property

Adds explicit name specification to anonymous type property declaration.

Add name to argument

Adds name to the selected argument.

Add string formatting method argument

Adds new format item to format string and corresponding argument to formatting method invocation

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

Add string interpolation argument

Adds new argument to string interpolation expression. Available over ordinary string literals as well

Add TestCase attribute

Adds TestCase attribute to nUnit test method

Add tuple component name

Adds explicit tuple component name based on names in target tuple type.

Add variable designation for pattern

Introduce variable designation for type test/null-checking/relational pattern and possibly replace casts inside corresponding switch section

Adds 'switch' condition component

Add 'switch' expression/statement component

Annotate enum members with 'EnumMemberAttribute'

Adds 'EnumMemberAttribute' to each enum member

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

Annotate member with nullability attribute

Annotates type member or parameter with nullability attribute.

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

Annotate members with 'DataMemberAttribute'

Adds 'DataMemberAttribute' to all public properties and fields

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

Annotate methods with 'OperationContractAttribute'

Adds 'OperationContractAttribute' to all exposed methods

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

Assert reference is not null

Adds assert statement that performs null reference check for a variable at the caret.

Change between 'set' and 'init' accessor

Change between 'set' and 'init' accessor kinds

Change member visibility

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

Change type declaration kind between 'class'/'struct' and 'record'

Change type declaration kind between 'class'/'struct' and 'record' possibly fixing some errors

Check all string parameters for nulls or empty strings

Checks all string parameters for nulls or empty strings

Check all string parameters for nulls or whitespace strings

Checks all string parameters for nulls or whitespace strings

Check array index value

Checks index value for arrays

Check collection index value

Checks index value for collections

Check dictionary key value

Checks key value for dictionaries

Check every parameter for null

Checks all function parameters for null.

Check if enum parameter is defined by enum type

Checks that function parameter is defined by enum type

Check if numeric parameter is out of range

Checks numeric parameter for specified range

Check if parameter is an empty collection

Checks function parameter for empty collection

Check if parameter is not valid

Checks function parameter for validity

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 string parameter is null or empty string

Checks string parameter for null or empty string

Check if string parameter is null or whitespace string

Checks string parameter for null or whitespace string

Check if variable is null

Checks variable for 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 replaces it (e.g. 1 + 1 replaced by 2).

Configure null-check assertion pattern

Opens ReSharper options page to configure null-check pattern.

Configure parameter null-check pattern

Opens ReSharper options page to configure null-check pattern.

Configure variable null-check pattern

Opens ReSharper options page to configure null-check pattern.

Convert '?:' conditional expression to 'if' statement

Converts conditional expression whose value is returned or assigned to an 'if' statement.

Convert '?:' conditional expression to 'switch' expression

Converts conditional expression whose value is returned or assigned to a 'switch' expression.

Convert '==' operator to 'Equals()' call

Converts usage of equality operator ('==') to a call of 'Equals' method.

Convert '==' operator to 'object.ReferenceEquals()' call

Converts usage of equality operator ('==') to a call to 'object.ReferenceEquals' method.

Convert anonymous method to lambda expression

Converts anonymous method expression to lambda expression.

Convert anonymous type to named class

Converts anonymous type to named class replacing its usages in selected scope.

Convert auto-property to property with default body

Convert auto-property to property with default body

For more information, see use auto-properties

Convert 'catch (Exception)' clause to 'catch'

Converts 'catch (System.Exception)' clause into 'catch' form.

Convert 'catch' clause to 'catch (Exception)'

Converts 'catch' clause into 'catch (System.Exception)' form.

Convert collection initializer into 'Add' method calls

Replaces collection initializer with the series of 'Add()' method calls.

Convert compound assignment to regular assignment

Converts compound assignment to regular assignment

Convert constructor to factory method

Converts constructor to factory method and updates usages to factory method call

Convert 'Equals' method call into '==' operator usage

Converts a call to instance or static 'Equals' method into usage of equality ('==') or inequality ('!=') operator.

Convert explicit to implicit implementation

Converts explicit implementation of an interface method to implicit one.

Convert expression body member to statement body

Converts expression-bodied member declaration to statement-bodied form

Convert expression lambda to statement lambda

Converts expression-bodied lambda expression to statement-bodied form

Convert 'ForEach' method call to 'foreach' statement

Converts 'xs.ForEach(x => ...)' calls into regular 'foreach' statement

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' statement to 'for' statement.

Convert 'if' statement to '?:' conditional expression

Works on 'if' statement that returns value or performs assignment inside each branch. It converts the statement to a conditional expression ('x ? a : b')

Convert 'if' statement to switch case guard clause

Works on 'if' statements at the beginning of a switch section and splits it into a guarded section with the 'if' content and unguarded section with the else branch

Convert 'if' statement to 'switch' expression

Works on 'if' statements that perform type checks or compare value of an expression with one or more constants. It converts 'if' statements into a single 'switch' expression.

Convert 'if' statement to 'switch' statement

Works on 'if' statements that perform type checks or compare value of an expression with one or more constants. It converts 'if' statements into a single 'switch' statement.

Convert implicit to explicit interface implementation

Converts implicit implementation of an interface member to explicit one.

Convert integer literal to binary form

Converts integer literal to binary form.

Convert integer literal to hexadecimal form

Converts integer literal to hexadecimal form.

Convert integral literal to decimal form

Converts integer literal to decimal form.

Convert invalid character literal to string

Convert invalid character literal into string literal

Convert iterator to method

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

Convert lambda expression to anonymous method

Converts lambda expression to anonymous method expression.

Convert LINQ to code

Converts LINQ to code

Convert LINQ to method 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 null coalescing assignment to if statement

Converts null coalescing assignment to if statement

Convert null coalescing expression to 'if' statement

Converts null coalescing expression to 'if' statement

Convert object initializer into assignment statements

Replaces object initializer with the series of assignment statements.

Convert object initializer into constructor invocation

Replaces object initializer with invocation of construсtor with parameters matching by name and type

Convert 'ReferenceEquals' method call into '==' operator usage

Converts a call to static 'ReferenceEquals' method into usage of equality ('==') or inequality ('!=') operator.

Convert statement body member to expression body

Converts statement-bodied member declaration to expression-bodied form

Convert statement lambda to expression lambda

Converts statement-bodied lambda expression to expression-bodied form

Convert string comparison to 'string.Equals' call

Converts string comparison int 'string.Equals' method call

Convert string interpolation to 'string.Format' call

Converts string interpolation expression into corresponding 'string.Format' method call

Convert string literal to string interpolation

Converts regular or verbatim string to corresponding kind of string interpolation expression.

Convert 'string.Format' to string interpolation

Converts 'string.Format' call to string interpolation (even in case that could change the order of arguments evaluation)

Convert 'switch' expression to conditional ?: expression(s)

Converts 'switch' expression to a series of conditional (ternary) ?: expressions

Convert 'switch' expression to 'if' statements

Converts 'switch' expression into one or multiple nested 'if' statements each checking for individual pattern

Convert 'switch' expression to 'switch' statement

Converts 'switch' expression to 'switch' statement.

Convert 'switch' statement to 'if' statements

Converts 'switch' statements into one or multiple nested 'if' statements each checking for individual pattern

Convert 'switch' statement to 'switch' expression

Converts 'switch' statement to 'switch' expression.

Convert to regular string interpolation

Converts verbatim string interpolation $@".." to regular $"..".

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

Convert to regular string literal

Converts verbatim string @".." to regular string "..".

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

Convert to 'using' declaration

Replace 'using' statement with 'using' declaration

Convert to verbatim string interpolation

Converts regular string interpolation $".." to verbatim $@"..".

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

Convert to verbatim string literal

Converts regular string literal ".." to verbatim string @"..".

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

Converts member value check expression to recursive pattern

Replaces member read access to check for some constant value with corresponding pattern

Converts not null check into object pattern check

Converts not null check expression into pattern-matching check

Copy XML documentation from base member

Copies XML documentation from base to overriding members/types

Create another part of a type declaration

Marks the type as partial if necessary and creates new part in new file

Create derived type

Creates class that implements interface or inherits class.

Create event invocator

Creates event invocator.

Create explicit array creation from 'params' parameter arguments

Create explicit array creation from 'params' parameter arguments

Create explicit constructor declaration for primary constructor

Create explicit constructor declaration for primary constructor of a record

Create explicit property declaration for positional parameter

Create explicit property declaration for positional parameter of a record

Create overload with selected argument's type

Available on method invocation, creates overload with selected argument's type

Create overload without parameter

Creates overload without given parameter. Calls current method

Create return from expression

Creates return statement with value that is taken as an expression statement

Deconstruct variable

Deconstructs variable into multiple positional components

Delete comment

Deletes comment

Enable "A suppressed nullable warning might hide an underlying problem" inspection

Suggests to enable "A suppressed nullable warning might hide an underlying problem" inspection when caret is on '!' operator.

Enable "Enforce braces in 'do-while' statement" inspection

Suggests to enable "Enforce braces in 'do-while' statement" inspection when caret is on 'do', 'while' keywords.

Enable "Enforce braces in 'fixed' statement" inspection

Suggests to enable "Enforce braces in 'fixed' statement" inspection when caret is on 'fixed' keyword.

Enable "Enforce braces in 'for' statement" inspection

Suggests to enable "Enforce braces in 'for' statement" inspection when caret is on 'for' keyword.

Enable "Enforce braces in 'foreach' statement" inspection

Suggests to enable "Enforce braces in 'foreach' statement" inspection when caret is on 'foreach' keyword.

Enable "Enforce braces in 'if' statement" inspection

Suggests to enable "Enforce braces in 'if' statement" inspection when caret is on 'if', 'else' keywords.

Enable "Enforce braces in 'lock' statement" inspection

Suggests to enable "Enforce braces in 'lock' statement" inspection when caret is on 'lock' keyword.

Enable "Enforce braces in 'using' statement" inspection

Suggests to enable "Enforce braces in 'using' statement" inspection when caret is on 'using' keyword.

Enable "Enforce braces in 'while' statement" inspection

Suggests to enable "Enforce braces in 'while' statement" inspection when caret is on 'while' keyword.

Enable "Local function can be made static" inspection

Suggests to enable "Local function can be made static" inspection when caret is on local function 'static' keyword.

Enable "Struct member can be readonly" inspection

Suggests to enable "Struct member can be readonly" inspection when caret is on 'readonly' keyword.

Enable "Suppress nullable warning with '!'" quick-fix in current solution

Suggests to enable "Suppress nullable warning with '!'" quick-fix in current solution when caret is on '!' token.

Enable "Unnecessary whitespace at the end of line" inspection

Suggests to enable "Unnecessary whitespace at the end of line" inspection when caret is on trailing whitespace.

Enable "Usage of tabulation character for indentation is prohibited" inspection

Suggests to enable "Usage of tabulation character for indentation is prohibited" inspection when caret is on whitespace with tab character.

Encapsulate lazy field

Encapsulating lazy field to property if there is no existing one

Evaluate expression

Evaluates simple expression and replaces it with evaluated value

Extract anonymous method expression to local function

Extracts anonymous method expression into local function in the containing scope.

Extract anonymous method expression to named method

Extracts anonymous method expression into private method of the containing type.

Extract lambda expression to local function

Extracts lambda expression into local function in the containing scope.

Extract lambda expression to named method

Extracts lambda expression into private method of the containing type.

Extract local function to regular method

Extracts local function into regular method in the containing type lifting its closures if necessary.

Fill object initializer

Initializes fields and properties in object initializer

Find nullable warning suppressions

Find all nullable warning suppression expressions in selected scope

Fix invalid escape sequences

Fix invalid escape sequences in string by escaping all characters

Fix invalid regular string

Fix invalid characters in string by making it verbatim

Fix regular expression

Fix invalid characters in regular expression

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

Fix ternary expression in string interpolation

Wraps ternary expression in parentheses in order to prevent interpolated string from interpreting its false branch as format specifier

Flip invocation expression

Flips the current invocation expression e.g. left.Equals(right) to right.Equals(left).

Flip operator arguments

Flips left and right operands for selected operator e.g. 'null == list' to 'list == null'.

Flip relational expression

Flips the current relational expression e.g. 'list.Count > 1' to '1 < list.Count'.

Fully qualify reference to type, static member or namespace

Insert full qualification for reference to type, static member or namespace

Generate method to check whether enum flag

Generates extension method to check whether enum value contains specified flag

Generate type patterns

Generates type patterns

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 custom event accessors

Adds placeholders for custom implementation of 'add' and 'remove' methods for an event.

Implement 'INotifyPropertyChanged' pattern

Creates method to invoke 'PropertyChanged' event with string literal parameter and adds ReSharper annotation to enable identifying this method by 'INotifyPropertyChanged' support

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

Import static members with 'using static' directive

Imports static members of type with C# 6.0 'using static' directive in file

Include member access into object pattern

Replaces member access in source expression of 'is'/'switch' operators with corresponding pattern(s)

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

Inline control transfer statement

Inline control transfer statement like 'return' or 'continue' into the statement above

Inline out variable declaration

Replaces local variable declaration as declaration expression

Inline string interpolation argument

Inlines string literal or nested string interpolation into containing interpolated string

Inline temporary variable

Inline temporary variable initialized with a value of other variable/parameter to reduce the amount of different names used to address the same value

Inlines variable into condition expression using this variable

Inlines variable into condition expression using this variable producing pattern matching

Insert anonymous method signature

Adds proper signature to parameterless declaration of an anonymous method.

Insert digit separators in integer literal

Places digit separators in common places of integer literals: separates thousands in decimal literals, 16-bit words in hexadecimal literals, bytes in binary literals.

Insert digit separators in real literal

Places digit separators to separate thousands in real literals of float/double/decimal type.

Insert generic method invocation type arguments

Inserts inferred type arguments of generic method invocation/delegate creation from method group expression. Available when caret is exactly at the end of method name

Insert lambda expression signature

Adds explicit type specifications for implicitly-typed lambda parameters.

Insert type specification after default literal

Converts default literal into default expression.

Introduce variable from standalone expression

Introduces variable from standalone statement

Invert '?:' operator condition

Inverts condition and swaps branches of the '?:' conditional expression.

Invert 'if' statement

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

Invoke extension method as static

Changes invocation syntax from extension method to static method.

Iterate via 'await foreach'

Generates an 'await foreach' statement iterating the expression.

Iterate via 'foreach'

Generates a 'foreach' statement iterating the expression.

Iterate via 'foreach' (based on Live Template)

Generates a 'foreach' statement iterating the expression.

Join attributes into single section

Rearranges attributes into single section

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 null check with assignment

Replace 'if' statement with code using ?? operator and throw expression

Join string literals

Concatenates two string literals into one.

Lift a local function closure to parameter

Converts a local function closure over a containing method's local variable into the local function's parameter

Make method partial

Converts private void method to partial method definition.

Mark string literal as string interpolation

Adds '$' to regular or verbatim string without changes to its content.

Match file name with type name

Renames current file to match the name of the only top-level type declared therein.

Merge deconstructed declaration

Merges deconstructed declaration into single variable declaration.

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.

Merge sequential checks into null-propagating expression

Merge sequential null/type checks using the conditional access expression ('?.' operator)

Merge sequential null/pattern checks into single pattern check

Merge sequential null/pattern checks into single recursive/logical pattern check

Move assignment in constructor to initializer

Moves assignment from constructor to field/event/property initializer

Move declaration(s) to another type part

Moves selected declarations range or a single declaration (if invoked without selection on declaration name) to another type part of a partial type.

Move initialization to constructor(s)

Moves field/event/property initializers to constructor(s)

Move local variable, constant or function declaration to outer scope

Moves local variable (with initialization), local constant or local function declaration 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 logical expression

Negates logical expression

Notify property changes

Adds call to the notification method

Override virtual member

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

Pass string interpolation expression

Replaces format method invocation with passing string interpolation expression. Use carefully, since some of format methods (like in logging frameworks) do not always execute the formatting of arguments while string interpolation expression always evaluates.

Pass 'string.Format' method invocation

Replaces format method invocation with passing 'string.Format' method call result. Use carefully, since some of format methods (like in logging frameworks) do not always execute the formatting of arguments while 'string.Format' always produces string.

Pull expression from variable initializer

Pull variable initializer expression to its usage(s)

Push expression to variable initializer

Push equivalent variable usage expression(s) to its initializer

Put variable inside 'using' statement

Converts variable declaration of type that implements the 'System.IDisposable' interface into 'using' statement. This is useful for enforcing lifetime for disposable objects.

Qualify static members imported via 'using static' directive

Inserts type qualification for static members usages imported in scope via C# 6.0 'using static' directive

Remove #region, #endregion directives

Removes region and corresponding endregion pair of directives

For more information, see add and remove #region blocks.

Remove argument name

Removes name from selected argument.

Remove braces

Removes unnecessary braces around one or more statements in the code

Remove digit separators from numeric literal

Removes digit separators from integer or real literals

Remove redundant parenthesis

Removes parenthesis in case they are redundant

Remove string formatting method argument

Removes format string item and corresponding formatting method argument from format method invocation.

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

Remove 'switch' condition component

Remove 'switch' expression/statement component

Remove tuple component name

Removes explicit tuple component name in tuple expression.

Replace '.IfNotNull(x => x.Smth)'-like call with '?.' expression

Replace usage of extension methods like '.IfNotNull(x => x.Smth)' with conditional access expression ('?.' operator)

Replace '?:' conditional operator with null-propagating expression

Replaces use of conditional expression ('?:' operator) with null-coalescing (?? operator) or conditional access expression (?. operator)

Replace array initializer with expression

Replaces array initializer with array creation expression.

Replace auto-property with property and backing field

Replaces auto-property with property that utilizes backing field.

For more information, see use auto-properties

Replace cast expression with safe 'as' cast

Replace regular cast expression with safe cast 'as' expression.

Replace conditional access expression with unconditional access

Replaces conditional access expression ('?.' operator) with regular unconditional access

Replace explicit type specification with 'var'

Allows to replace type with 'var' even in the case when doing so would change the type of the variable.

Replace 'if' statement with null-propagation

Replace 'if' statement with conditional access expressions (null-propagation)

Replace logical expression with equal expression

Invert logical expression with equal expression

Replace member access with conditional access expression

Replaces member access/invocation or indexer access with conditional access expression ('?.' operator)

Replace null-propagating expression with '?:' conditional operator

Replaces use of null-coalescing ('??' operator) or conditional access expression ('?.' operator) with conditional expression ('?:' operator)

Replace null-propagating expression with 'if' statement

Replace C# 6.0 conditional access expression with 'if' statement

Replace property with backing field with auto-property

Replaces property that utilizes backing field with auto-property.

For more information, see use auto-properties

Replace safe 'as' cast expression with regular cast

Replace safe 'as' cast expression with regular cast expression.

Replace separate deconstruction declarations with single declaration

Replaces separate deconstruction declarations with single declaration

Replace 'var' with explicit type declaration

Replace 'var' with explicit type declaration.

Reverse assignment statement

Reverses source and destination parts of an assignment statement.

Reverse 'for' loop statement

Reverses order of iteration in 'for' loop statement.

Set project 'ConfigureAwait' analysis mode

Sets project 'ConfigureAwait' analysis mode.

Set project language level

Set project language level

Specify array type explicitly

Adds explicit type specification to array creation expression.

Specify created type

Specify created type explicitly

Specify enum member values

Add explicit value specifications to all enum members

Split 'and' patterns into multiple 'is' expressions or guard expression

Split logical 'and' patterns into sequence of 'is' expressions or guard expression

Split attributes into separate sections

Rearranges attributes into separate sections

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 guard clause with '||'-condition into two case labels with guard clauses

Works on a switch case label whose guard clause is a disjunction ('||') of two simpler conditions. It converts the switch case label into two separate labels.

Split 'if' with '&&'-condition into nested 'if'-statements

Works on an 'if' statement, whose condition is a conjunction ('&&') of two simpler conditions. It converts the 'if' statement into two nested 'if' statements.

Split 'if' with '||'-condition into two 'if'-statements

Works on an 'if' statement, whose condition is a disjunction ('||') of two simpler conditions. It converts the 'if' statement into two 'if' statements with equal bodies.

Split into nested patterns

Create a separate recursive pattern to match on a nested property

Split local variable declaration and initialization

Moves variable initializer expression into separate assignment statement.

Split local variable declaration and initialization

Moves variable declaration to outer scope.

Split null-propagating expression into sequential checks

Split conditional access expression ('?.' operator) into sequential null/type checks

Split 'or' patterns into multiple 'is' expressions or 'switch' cases

Split logical 'or' patterns into sequence of 'is' expressions or multiple 'switch' cases

Split recursive pattern into several consecutive checks

Extracts subpatterns of a pattern into checks joined by `&&` operator

Split 'return' statement of boolean value to 'if' statement

Works on a 'return' statement, whose value is of the boolean type. It converts the 'return' statement into an 'if' statement with two 'return' statements, returning 'true' and 'false' values.

Split 'return' with '&&'-condition into guarding 'if' and 'return'

Works on a 'return' statement, whose value is a conjunction ('&&') of two simpler conditions. It converts the 'return' statement into a guarding 'if' statement and a 'return'.

Split string literal

Splits string literal into two literals.

Split value return with '||' condition into 'if' and 'return' statements

Works on a 'return' statement, whose value is a disjunction ('||') of two simpler conditions. It converts the 'return' statement into 'if' and 'return' statements.

Surround string literal with 'string.Format' call

Surrounds string literal with 'string.Format()' method call.

Surround with ""

Creates string literal of selection text.

Test regular expression

Open dialog to edit and test regular expression against example text

To abstract/virtual/non-abstract/non-virtual member

Makes type member abstract, virtual or non-abstract and non-virtual.

To block-scoped namespace

Converts file-scoped to block-scoped namespace

To file-scoped namespace

Converts namespace with block body to file-scoped namespace

To LINQ to JSON

Convert JSON string to JSON.NET object

To LINQ to XML

Convert XML string to LINQ to XML object

To named property patterns

Replace positional deconstruction patterns clause with named property patterns over corresponding members.

To precompiled 'Regex' object

Introduce field and precompile object of 'Regex' type

For more information, see regular expressions assistance.

Uncomment

Removes comments from a code block

For more information, see comment and uncomment code.

Use 'as' and check for null

Converts 'if (a is B) { }' to 'var b = a as B; if (b != null) { }' and updates usages

Use 'ConfigureAwait(false)' call

Adds 'ConfigureAwait(false)' call to a task like expression in 'await' context.

Use explicit discard declaration

Adds 'var' to discard declaration in order to prevent possible clash with other elements named '_'

Use explicit or implicit tuple component name

Available on tuple components references

Use format string

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

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

Use implicit discard declaration

Removes redundant 'var' keyword from discard declaration

Use object/collection initializer instead of assignments/.Add() method calls

Replaces series of assignments or 'Add()' invocations with object or collection initializer expression

For more information, see code inspection: use object or collection initializer when possible.

Use positional deconstruction pattern

Replace property pattern member(s) of recursive pattern with positional deconstruction patterns

Use separate declarations in deconstruction declaration/patterns

Replaces single declaration with separate variable declarations inside deconstruction

Use Span<T> for stack allocated variable

Use Span<T> for stack allocated variable

Use string interpolation

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

Use 'System.Environment.NewLine' value

Use 'System.Environment.NewLine' instead of "\n", "\r" or "\r\n" literal.

Use 'System.String.Empty' value

Use 'System.String.Empty' instead of "" literal.

Use target-typed new

Simplify 'new' expression by removing explicit type specification

Last modified: 07 April 2022