Skip to main content

RCS1073: Convert 'if' to 'return' statement

Properties​

PropertyValue
Default SeverityInfo
Minimum language version-

Examples​

Example #1​

diagnostic.cs
if (x)
{
return true;
}
else
{
return false;
}
fix.cs
return x;

Example #2​

diagnostic.cs
if (x != null)
{
return x;
}
else
{
return null;
}
fix.cs
return x;

Applies to​