我讀C#article.It表明catch塊的選擇
在catch塊結束時,你有三種選擇:
•重新拋出同樣的異常,通知碼在調用堆棧中出現較高的異常。
•拋出一個不同的異常,給出更豐富的異常信息,以便在調用堆棧中更高地編寫更高的 。
•讓線脫離捕捉塊的底部。
我無法理解points.It將是一個很大的幫助,如果你給予簡單的例子說明之。
在此先感謝。
更新: 當我需要處理重新拋出異常,我需要有嵌套的try ... catch塊像
try
{
try
{
}
catch(InvalidOperationException exp)
{
throw;
}
}
catch(Exception ex)
{
// handle the exception thrown by inner catch block
// (in this case the "throw" clause inside the inner "catch")
}
}
這個'c#文章',是否包含代碼示例? – 2009-10-07 09:37:46