我应该在最后一块写Try-Catch ..它可能吗? [英] Shall I Write Try-Catch In Finally Block.. Is It Possible?

查看:118
本文介绍了我应该在最后一块写Try-Catch ..它可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该在finally块中编写try-catch ..是否可能?????????????????????????????????????????????????????????????? try-catch块是非常昂贵的,所以你不应该使用它,除了没有其他方法来捕获故障...这个结果调查 [ ^ ]可能会给你想法在哪里使用,哪里没有......

为了更具体,你必须分享你打算使用嵌套的try-catch块的确切情况......


是的,它是可能的。无论你真的应该这样做我都说不清楚,因为我不知道你想要完成什么。


这里有更好的建议:

http://stackoverflow.com/问题/ 4799758 / is-nested-try-catch-blocks-a-bad-idea [ ^ ]



重构可能是一种选择。

shall i write try-catch in finally block.. is it possible??????????

解决方案

Syntactically it is possible - however a try-catch block is very expensive so you should not use it except there is no other way to catch malfunctioning...The results of this survey[^] may give you ideas where to use and where not...
To be more specific you must share the exact case you intend to use nested try-catch blocks...


Yes, it's possible. Whether you actually should do it I can't tell because I don't know what you're trying to accomplish.


There is more good advice here:
http://stackoverflow.com/questions/4799758/are-nested-try-catch-blocks-a-bad-idea[^]

Refactoring may be an option.


这篇关于我应该在最后一块写Try-Catch ..它可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆