Skip to main content

Extract expression from condition

PropertyValue
IdRR0043
Applicable Syntaxif statement, while statement
Syntax Spancondition
Enabled by Default✓

Usage​

Example #1​

before.cs
if (x && y) // Select 'y'
{
}
after.cs
if(x)
{
if (y)
{
}
}

Example #2​

before.cs
if (x || y) // Select 'y'
{
}
after.cs
if(x)
{
}

if (y)
{
}

Configuration​

roslynator_refactoring.extract_expression_from_condition.enabled = true|false