Switch statement with huge number of cases

前端 未结 4 690
有刺的猬
有刺的猬 2021-02-14 06:08

What happens if the switch has more than 5000 case. What are the drawbacks and how we can replace it with something faster?

Note: I am not expe

4条回答
  •  长情又很酷
    2021-02-14 06:47

    Try to use Dictionary class with Delegate values. At least it makes code a little bit more readable.

提交回复
热议问题