Why is try {…} finally {…} good; try {…} catch{} bad?

后端 未结 20 2389
执笔经年
执笔经年 2020-11-28 01:30

I have seen people say that it is bad form to use catch with no arguments, especially if that catch doesn\'t do anything:

StreamReader reader=new  StreamRead         


        
20条回答
  •  醉酒成梦
    2020-11-28 01:53

    Finally is optional -- there's no reason to have a "Finally" block if there are no resources to clean up.

提交回复
热议问题