RCS1208: Reduce 'if' nesting
Properties
| Property | Value |
|---|---|
| Default Severity | disabled by default |
| Minimum language version | - |
Examples
Example #1
diagnostic.cs
if (condition1)
{
Foo1();
if (condition2)
{
Foo2();
if (condition3)
{
Foo3();
}
}
}
fix.cs
if (!condition1)
{
return;
}
Foo1();
if (!condition2)
{
return;
}
Foo2();
if (!condition3)
{
return;
}
Foo3();