Inspectopedia 2025.3 Help

Redundancies in Code

'??' condition is known to be null or not null  

'??' condition is known to be null or not null.

'??' condition is never null according to nullable reference types' annotations  

'??' condition is never null according to nullable reference types' annotations.

'ContainsKey' call is redundant before adding the item to the dictionary  

'ContainsKey' call is redundant before adding the item to the dictionary.

'true' is redundant as 'for'-statement condition  

'true' is redundant as 'for'-statement condition.

[NotNull] or [CanBeNull] attribute is applied to a type that already has the same annotation from nullable reference types  

[NotNull] or [CanBeNull] attribute is applied to a type that already has the same annotation from nullable reference types.

Anonymous method signature is not necessary  

Anonymous method signature is not necessary.

Array creation can be replaced with array initializer  

Array creation can be replaced with array initializer.

Assignment is not used  

Assignment is not used.

Assignment results are fully discarded  

Assignment results are fully discarded.

Comparison to integral constant is useless  

Comparison to integral constant is useless.

Conditional access qualifier expression is known to be null or not null  

Conditional access qualifier expression is known to be null or not null.

Conditional access qualifier expression is not null according to nullable reference types' annotations  

Conditional access qualifier expression is not null according to nullable reference types' annotations.

CQRS attribute is redundant and can be removed  

CQRS attribute is redundant and can be removed.

Double negation operator  

Double negation operator.

Duplicated statements  

Duplicated statements.

Empty 'for' loop is redundant  

Empty 'for' loop is redundant.

Empty region  

Empty region.

Explicit delegate creation expression is redundant  

Explicit delegate creation expression is redundant.

Expression is always 'null'  

Expression is always 'null'.

Expression is always 'true' or 'false' according to nullable reference types' annotations  

Expression is always 'true' or 'false' according to nullable reference types' annotations.

Expression is always 'true' or always 'false'  

Expression is always 'true' or always 'false'.

Heuristically unreachable code  

Heuristically unreachable code.

Immediate delegate invocation  

Immediate delegate invocation.

Math.Abs() argument is always non-negative  

Math.Abs() argument is always non-negative.

Math.Sign() method always gives the same result  

Math.Sign() method always gives the same result.

Parentheses are redundant if attribute has no arguments  

Parentheses are redundant if attribute has no arguments.

Pattern is always 'true' or always 'false'  

Pattern is always 'true' or always 'false'.

Private field can be converted into local variable  

Private field can be converted into local variable.

Raw string can be simplified  

Raw string can be simplified.

Redundant 'abstract' modifier  

Redundant 'abstract' modifier.

Redundant 'Attribute' suffix  

Redundant 'Attribute' suffix.

Redundant 'base.' qualifier  

Redundant 'base.' qualifier.

Redundant 'case' label  

Redundant 'case' label.

Redundant 'case' label before default section  

Redundant 'case' label before default section.

Redundant 'class' keyword in record declaration  

Redundant 'class' keyword in record declaration.

Redundant 'else' keyword  

Redundant 'else' keyword.

Redundant 'IEnumerable.Cast<T>' or 'IEnumerable.OfType<T>' call  

Redundant 'IEnumerable.Cast<T>' or 'IEnumerable.OfType<T>' call.

Redundant 'notnull' constraint on type parameter constrained by non-nullable base type  

Redundant 'notnull' constraint on type parameter constrained by non-nullable base type.

Redundant 'object.ToString()' call  

Redundant 'object.ToString()' call.

Redundant 'object.ToString()' call for value types  

Redundant 'object.ToString()' call for value types.

Redundant 'orderby' clause 'ascending' keyword  

Redundant 'orderby' clause 'ascending' keyword.

Redundant 'readonly' modifier  

Redundant 'readonly' modifier.

Redundant 'scoped' parameter modifier  

Redundant 'scoped' parameter modifier.

Redundant 'string.Format()' call  

Redundant 'string.Format()' call.

Redundant 'string.ToCharArray()' call  

Redundant 'string.ToCharArray()' call.

Redundant 'switch' expression arms  

Redundant 'switch' expression arms.

Redundant 'virtual' modifier  

Redundant 'virtual' modifier.

Redundant 'WithCancellation()' invocation  

Redundant 'WithCancellation()' invocation.

Redundant [AttributeUsage] attribute property assignment  

Redundant [AttributeUsage] attribute property assignment.

Redundant anonymous type property explicit name  

Redundant anonymous type property explicit name.

Redundant argument passed to caller argument expression parameter  

Redundant argument passed to caller argument expression parameter.

Redundant argument with default value  

Redundant argument with default value.

Redundant arithmetic overflow checking context  

Redundant arithmetic overflow checking context.

Redundant boolean comparison  

Redundant boolean comparison.

Redundant braces in collection initializer  

Redundant braces in collection initializer.

Redundant cast  

Redundant cast.

Redundant catch clause  

Redundant catch clause.

Redundant collection copy  

Redundant collection copy.

Redundant condition check before assignments  

Redundant condition check before assignments.

Redundant conditional ternary expression usage  

Redundant conditional ternary expression usage.

Redundant context capturing with 'ConfigureAwait'  

Redundant context capturing with 'ConfigureAwait'.

Redundant control flow jump statement  

Redundant control flow jump statement.

Redundant discard designation  

Redundant discard designation.

Redundant empty argument list on object creation expression  

Redundant empty argument list on object creation expression.

Redundant empty finally block  

Redundant empty finally block.

Redundant empty object or collection initializer  

Redundant empty object or collection initializer.

Redundant empty switch section  

Redundant empty switch section.

Redundant explicit collection creation in argument of 'params' parameter  

Redundant explicit collection creation in argument of 'params' parameter.

Redundant explicit nullable type creation  

Redundant explicit nullable type creation.

Redundant explicit positional property declaration  

Redundant explicit positional property declaration.

Redundant explicit size specification in array creation  

Redundant explicit size specification in array creation.

Redundant explicit tuple component name  

Redundant explicit tuple component name.

Redundant explicit type in array creation  

Redundant explicit type in array creation.

Redundant fixed pointer declaration  

Redundant fixed pointer declaration.

Redundant global using directive  

Redundant global using directive.

Redundant lambda expression parameter type specification  

Redundant lambda expression parameter type specification.

Redundant lambda signature parentheses  

Redundant lambda signature parentheses.

Redundant name qualifier  

Redundant name qualifier.

Redundant nullable annotation on 'class?' constraint of type parameter constrained by non-nullable base type  

Redundant nullable annotation on 'class?' constraint of type parameter constrained by non-nullable base type.

Redundant nullable annotation on base type constraint of type parameter constrained by another non-nullable base type  

Redundant nullable annotation on base type constraint of type parameter constrained by another non-nullable base type.

Redundant nullable annotation on base type constraint of type parameter having non-nullable type kind  

Redundant nullable annotation on base type constraint of type parameter having non-nullable type kind.

Redundant nullable attribute  

Redundant nullable attribute.

Redundant nullable directive  

Redundant nullable directive.

Redundant nullable warning suppression expression  

Redundant nullable warning suppression expression.

Redundant operand in logical conditional expression  

Redundant operand in logical conditional expression.

Redundant property pattern clause  

Redundant property pattern clause.

Redundant range bound  

Redundant range bound.

Redundant semicolon after type or namespace declaration  

Redundant semicolon after type or namespace declaration.

Redundant string interpolation  

Redundant string interpolation.

Redundant type arguments inside 'nameof'  

Redundant type arguments inside 'nameof'.

Redundant type arguments of method  

Redundant type arguments of method.

Redundant type check in a pattern  

Redundant type check in a pattern.

Redundant type declaration body  

Redundant type declaration body.

Redundant using directive  

Redundant using directive.

Redundant verbatim prefix  

Redundant verbatim prefix.

Redundant verbatim string prefix  

Redundant verbatim string prefix.

Remove redundant pattern-matching parentheses  

Remove redundant pattern-matching parentheses.

Subpattern that always matches is redundant  

Subpattern that always matches is redundant.

Type check for nullable type is equal to underlying type check  

Type check for nullable type is equal to underlying type check.

Unsafe context declaration is redundant  

Unsafe context declaration is redundant.

Unused nullable directive  

Unused nullable directive.

Last modified: 02 March 2026