Back to Devexpress

CRR0019 - Expression contains redundant subsets

coderushforroslyn-118140-static-code-analysis-analyzers-library-crr0019-expression-contains-redundant-subsets.md

latest1.0 KB
Original Source

CRR0019 - Expression contains redundant subsets

  • Feb 28, 2025

This analyzer detects logical expressions that can be simplified. For instance, refer to the following example.

csharp
if(v == 2 && v != 10) // CRR0019
    return;
vb
If v = 2 AndAlso v <> 10 Then ' CRR0019
    Return
End If

In the expression above, the second part ( v != 10 ) is redundant, because it will always be satisfied in case the first part ( v == 2 ) is true.

To fix this issue, use the Simplify Expression refactoring or manually remove the redundant part(s) if the refactoring is not available on your expression.

csharp
if(v == 2)
    return;
vb
If v = 2 Then
    Return
End If

See Also

Suppress Analyzers