在try块中抛出异常? [英] Throwing exception in a try block?

查看:79
本文介绍了在try块中抛出异常?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在try块中抛出异常是不好的编程设计然后

抓住它?

is it a bad programming design to throw exception in the try block then
catch it??

推荐答案

与if相比陈述,是的,非常糟糕。

Compared to an "if" statement, yes, very bad.


比较任何不好的东西。


希望我的拼贴画读这个。

凯文

穆罕默德 < m@abdulfatah.net>在消息中写道

news:11 ********************** @ l41g2000cwc.googlegr oups.com ...
Compare to anything it''s bad.

hope my collage read this.
Kevin
"Mohammad" <m@abdulfatah.net> wrote in message
news:11**********************@l41g2000cwc.googlegr oups.com...
与if相比陈述,是的,非常糟糕。
Compared to an "if" statement, yes, very bad.



嗨凯文,


取决于。例如,如果你有一个深度嵌套的过程,抛出一个

异常退出可能是一种可行的方法。

但是,通常抛出异常代价高昂且抛出异常

应该表示错误。


-

Miha Markic [MVP C#] - RightHand .NET咨询&开发
www.rthand.com

SLODUG - 斯洛文尼亚开发者用户组 www.codezone-si.info

" Kevin Yu" < KO ** @ hotmail.com>在消息中写道

新闻:eU ************** @ TK2MSFTNGP14.phx.gbl ...
Hi Kevin,

Depends. For example, if you have a deeply nested procedure, throwing an
exception to exit might be a viable way.
However, normally throwing an exception is costly plus throwing an exception
should signal an error.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone-si.info

"Kevin Yu" <ko**@hotmail.com> wrote in message
news:eU**************@TK2MSFTNGP14.phx.gbl...
这是一个糟糕的编程设计在try块中抛出异常然后抓住它?
is it a bad programming design to throw exception in the try block then
catch it??



这篇关于在try块中抛出异常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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