C#

C#

Made by DeepSource

if conditions can be merged CS-R1039

Anti-pattern
Major

Nested if conditions can be merged together into a single condition. This can help improve code readability in complex codebases and reduce indentation level.

Bad Practice

if (condition1)
{
    if (condition2)
    {
        if (condition3)
        {
            // ...
        }
    }
}

Recommended

if (condition1 && condition2 && condition3)
{
    // ...
}