Permalink
Fetching contributors…
Cannot retrieve contributors at this time
39 lines (29 sloc) 1.51 KB

Replace ?: with if-else

Property Value
Id RR0120
Title Replace ?: with if-else
Syntax local declaration statement with conditional expression, assignment with conditional expression, return statement conditional expression, yield statement conditional expression
Enabled by Default

Usage

Before

string s = (condition) ? "a" : "b";
{
}

After

string s;
if (condition)
{
    s = "a";
}
else
{
    s = "b";
}

See Also

(Generated with DotMarkdown)