Language Usage Opportunities
- 'if' statement can be rewritten as '?:' expression
'if' statement can be rewritten as '?:' expression.
- 'if' statement can be rewritten as '??' expression
'if' statement can be rewritten as '??' expression.
- 'if' statement can be rewritten as '??=' assignment
'if' statement can be rewritten as '??=' assignment.
- 'if-return' statement can be rewritten as 'return' statement
'if-return' statement can be rewritten as 'return' statement.
- Append to collection expression
Append to collection expression.
- Class cannot be instantiated
Class cannot be instantiated.
- Conditional expression can be rewritten as null-coalescing
Conditional expression can be rewritten as null-coalescing.
- Convert 'as' expression type check and the following null check into negated pattern matching
Convert 'as' expression type check and the following null check into negated pattern matching.
- Convert 'as' expression type check and the following null check into pattern matching
Convert 'as' expression type check and the following null check into pattern matching.
- Convert 'if' statement into 'switch'
Convert 'if' statement into 'switch'.
- Convert 'Nullable<T>' into 'T?'
Convert 'Nullable<T>' into 'T?'.
- Convert constructor into member initializers
Convert constructor into member initializers.
- Convert constructor into primary constructor
Convert constructor into primary constructor.
- Convert delegate variable into local function
Convert delegate variable into local function.
- Convert into 'await using' statement or declaration
Convert into 'await using' statement or declaration.
- Convert into 'using' declaration
Convert into 'using' declaration.
- Convert into lambda expression
Convert into lambda expression.
- Convert into static class
Convert into static class.
- Convert lambda expression into method group
Convert lambda expression into method group.
- Convert negated 'is' expression into 'is' expression with negated pattern
Convert negated 'is' expression into 'is' expression with negated pattern.
- Convert property into auto-property
Convert property into auto-property.
- Convert property into auto-property (when possible)
Convert property into auto-property (when possible).
- Convert property into auto-property with private setter
Convert property into auto-property with private setter.
- Convert static method invocation into extension method call
Convert static method invocation into extension method call.
- For-loop can be converted into foreach-loop
For-loop can be converted into foreach-loop.
- Foreach loop can be converted into LINQ-expression but another 'GetEnumerator' method will be used
Foreach loop can be converted into LINQ-expression but another 'GetEnumerator' method will be used.
- Inline 'out' variable declaration
Inline 'out' variable declaration.
- Inline temporary variable
Inline temporary variable.
- Introduce optional parameters (non-private accessibility)
Introduce optional parameters (non-private accessibility).
- Introduce optional parameters (private accessibility)
Introduce optional parameters (private accessibility).
- Invert 'if' statement to reduce nesting
Invert 'if' statement to reduce nesting.
- Join null check with assignment
Join null check with assignment.
- Lambda expression/anonymous method can be made 'static'
Lambda expression/anonymous method can be made 'static'.
- Lambda expression/anonymous method must be 'static' to avoid allocations
Lambda expression/anonymous method must be 'static' to avoid allocations.
- Lambda expression/anonymous method must not have captures of the containing context
Lambda expression/anonymous method must not have captures of the containing context.
- Literal length can be reduced by using verbatim string
Literal length can be reduced by using verbatim string.
- Loop can be converted into LINQ-expression
Loop can be converted into LINQ-expression.
- Merge 'and' pattern
Merge 'and' pattern.
- Merge conditional ?: expression into conditional access
Merge conditional ?: expression into conditional access.
- Merge negated null/pattern checks into complex pattern
Merge negated null/pattern checks into complex pattern.
- Merge nested property patterns
Merge nested property patterns.
- Merge null/pattern checks into complex pattern
Merge null/pattern checks into complex pattern.
- Merge null/pattern/value checks into 'or'/'and' patterns
Merge null/pattern/value checks into 'or'/'and' patterns.
- Merge sequential checks into single conditional access check
Merge sequential checks into single conditional access check.
- Move to existing positional deconstruction pattern
Move to existing positional deconstruction pattern.
- Move variable declaration inside loop condition
Move variable declaration inside loop condition.
- Part of foreach loop can be converted into LINQ-expression but another 'GetEnumerator' method will be used
Part of foreach loop can be converted into LINQ-expression but another 'GetEnumerator' method will be used.
- Part of loop's body can be converted into LINQ-expression
Part of loop's body can be converted into LINQ-expression.
- Pass string interpolation expression
Pass string interpolation expression.
- Redundant accessor body
Redundant accessor body.
- Redundant spread element
Redundant spread element.
- Replace 'SequenceEqual' with constant pattern
Replace 'SequenceEqual' with constant pattern.
- Replace 'Slice' with range indexer
Replace 'Slice' with range indexer.
- Replace 'Substring' with range indexer
Replace 'Substring' with range indexer.
- Replace 'switch' statement with 'switch' expression
Replace 'switch' statement with 'switch' expression.
- Replace auto-property with computed property
Replace auto-property with computed property.
- Replace if statement with null-propagating code
Replace if statement with null-propagating code.
- Replace object pattern not performing any additional checks with 'var' pattern
Replace object pattern not performing any additional checks with 'var' pattern.
- Replace ternary expression with 'switch' expression
Replace ternary expression with 'switch' expression.
- Replace with 'field' keyword
Replace with 'field' keyword.
- Replace with primary constructor parameter
Replace with primary constructor parameter.
- Use 'nameof' expression to reference enum member name
Use 'nameof' expression to reference enum member name.
- Use 'nameof' expression to reference name
Use 'nameof' expression to reference name.
- Use 'nameof' expression to reference name in part of the string literal
Use 'nameof' expression to reference name in part of the string literal.
- Use 'nameof' expression to reference type name
Use 'nameof' expression to reference type name.
- Use 'nameof' expression when registering a DependencyProperty
Use 'nameof' expression when registering a DependencyProperty.
- Use 'with' expression to copy anonymous object
Use 'with' expression to copy anonymous object.
- Use 'with' expression to copy record
Use 'with' expression to copy record.
- Use 'with' expression to copy struct
Use 'with' expression to copy struct.
- Use 'with' expression to copy tuple
Use 'with' expression to copy tuple.
- Use alias
Use alias.
- Use collection expression syntax
Use collection expression syntax.
- Use compound assignment
Use compound assignment.
- Use deconstruction
Use deconstruction.
- Use deconstruction to swap variables
Use deconstruction to swap variables.
- Use discard assignment
Use discard assignment.
- Use index from end expression
Use index from end expression.
- Use object or collection initializer when possible
Use object or collection initializer when possible.
- Use positional deconstruction pattern
Use positional deconstruction pattern.
- Use raw string
Use raw string.
- Use string interpolation expression
Use string interpolation expression.
- Use type annotation syntax
Use type annotation syntax.
- Use unsigned right shift operator '>>>'
Use unsigned right shift operator '>>>'.
- Use UTF-8 string literal
Use UTF-8 string literal.