摘要:                    
大家都知道,代码中出现过多的if…else嵌套语句时很难读,所以常用switch…case语句进行代替,代码的可读性就好了很多。举个简单的例子:public void DoSomeThing(string str) { if (str == "A") { DoSomethingForA(str); } else if (str == "B") { DoSomethingForB(str); } else if (str == "C") { DoSomethingForC(str); } }我们一眼就看出,这段代码可以使用switch语                阅读全文
            
        
                    
                
浙公网安备 33010602011771号