Skip to main content

CRR0008 - If-block matches else-block

This analyzer detects if-else conditional statements with similar code in both branches.

if (condition) // CRR0008
    DoSomething();
else
    DoSomething();

Such statements are redundant because the condition value does not change the execution result. Consider modifying one of the branches or deleting the conditional statement along with one branch.

See Also