Skip to main content

Convert statements to if-else

PropertyValue
IdRR0211
Applicable Syntaxselected statements (first statement must be 'if' statement)
Enabled by Default

Usage

Example #1

before.cs
if (x)
return 1;

if (y)
{
return 2;
}
else if (z)
{
return 3;
}

return 0;
after.cs
if (x)
{
return 1;
}
else if (y)
{
return 2;
}
else if (z)
{
return 3;
}
else
{
return 0;
}

Configuration

roslynator_refactoring.convert_statements_to_if_else.enabled = true|false