Is there any significant difference between using if/else and switch-case in C#?

前端 未结 20 826
时光取名叫无心
时光取名叫无心 2020-11-22 07:25

What is the benefit/downside to using a switch statement vs. an if/else in C#. I can\'t imagine there being that big of a difference, other than m

20条回答
  •  情话喂你
    2020-11-22 07:41

    My 2 cents on it. Well most of the times if performance is not a criteria than it's more about code readability. If the the number of if/else statements are too many than using switch statement is better.

提交回复
热议问题