Telerik® JustCode™ by Progress

Telerik® JustCode™ can suggest you to convert multiple if-else statements to a switch statement where possible.

Note

Language Support

Supported: C#, VB.NET

Not supported: JavaScript

Not irrelevant: ASP.NET, XAML, HTML

The behavior can be controlled in JustCode Options - JustCode / Options / Code Analysis / Hints / C#.

When "Convert if to switch statement" option is checked in the options dialog, then Telerik® JustCode™ suggests you to convert multiple if-else statements to a switch statement where possible.

To convert if statement to switch statement

  1. Position the caret on the if which you'd like to be converted to switch statement.

  2. Select Convert if to switch statement from the VisualAid's Fixes menu.

    Convert If To Switch
  3. The result is:

    Convert If To Switch Result

See Also