The requested page is not available for the requested platform. You are viewing the content for Default platform.

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();
}