How to reduce Cyclomatic complexity of Switch case statements

前端 未结 3 1067
攒了一身酷
攒了一身酷 2021-01-13 01:50

There is an function which has switch case and we need to reduce its CC

       string data = string.empty;
       switch (value)
        {
            case \         


        
3条回答
  •  一向
    一向 (楼主)
    2021-01-13 02:33

    You could use a dictionary lookup in this case, it would be a little less code and clearer.

提交回复
热议问题