Special "else if" treatment - Why ???

In ReSharper there is an option "Special "else if" treatment for C#"
Can someone give me a qualified reason, why to prevent "else if" statements ?

0
2 comments
Avatar
Permanently deleted user

There are people who perceives 'else if' construct as a single one, not as a
one-statement else branch of an enclosing if construct.
See for example Visual Basic's construct If - ElseIf - EndIf

--
Sergey V. Coox
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


0
Avatar
Permanently deleted user

Hello,

In ReSharper there is an option "Special "else if" treatment for C#"
Can someone give me a qualified reason, why to prevent "else if"
statements ?


I guess you're speaking about the code formatter options, which don't have
anything to do to the parsing logic.

With special treatment, it's formatted into

if(…)
…
else if(…)
…

And without it things would look like this:
if(…)
…
else
{
if(…)
…
}

I believe there's also a preview in the options.

The first view is more “switch-case”ish in its look, which corresponds to
the nature of this construct.

—
Serge Baltic
JetBrains, Inc — http://www.jetbrains.com
“Develop with pleasure!”


0

Please sign in to leave a comment.