我该怎么做?试试看 - 最后在If语句中,如何继续?
void x()
{....
if (...)
{try
{}
catch (ComException com)
{ throw com}
finally // in any case, executed fine!
{...instructions.......}
}
... instructions...// not executed in case of exception because the finally can't embrace the following code too... but this block of code needs to be executed in any case too...
{}
}
你为什么要在catch块中抛出异常? – 2010-04-09 21:21:33
@Matthew Jones 我猜OP正在省略catch块内的一些日志代码。否则是的,抓住并重新抛出是没有意义的。 – 2010-04-09 21:33:34
,因为我必须捕捉一个特殊的异常,Com一个,然后把它扔到调用方法,也许语法可以减轻...(IM在C#)...但没有没有其他代码在赶上但抛出....否则你会怎么写它? – KitAndKat 2010-04-09 21:34:00