Skip to main content

CRR0009 - Subsequent if-statements have identical conditions

This analyzer detects a conditional statement followed by another conditional statement with a similar condition. See the example below.

if (condition) // CRR0009
    DoSomething();

if (condition)
    DoSomethingElse();

Subsequent conditional statements with identical conditions can always be combined into a single conditional statement. Use the Combine/Split Conditional(s) refactoring to combine them automatically.

if (condition){
    DoSomething();
    DoSomethingElse();
}