我該怎麼做?試試看 - 最後在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