try
{
  //區塊
}
catch (Exception e)
{
  //例外 Exception 錯誤 --> Thread.Abort
}

例外:假設自己編寫程式時,觀察在事件檢視器中是否有出現我們預期的應用程式事件產生;必要打開[工作管理員],[處理程序]中有無關掉執行緒(thread)程式? 避免其他執行緒(thread)所困住
原來在執行Thread.Abort()方法的時候,會引發一個System.Threading.ThreadAbortException的例外,關於這個例外的說明可以參考 MSDN:Thread.Abort 方法。

又例如:
catch {System.IndexOutOfRangeException e}
{
  //處理索引值 System.IndexOutOfRangeException 錯誤1
  //例如:
  Console.WriteLine("{0} Caught exception #1.", e);
}
catch {System.OutOfMemoryException e}
{
  //處理索引值 System.OutOfMemoryException 錯誤
  //例如:
  Console.WriteLine("Caught exception #2.");
}
finally
{
  Console.WriteLine("Executing finally block.");
}

http://www.dotblogs.com.tw/billchung/archive/2009/04/04/7851.aspx

http://yanchi-huang.blogspot.com/2009/05/c-trycatch.html

http://msdn.microsoft.com/zh-tw/library/0yd65esw(VS.80).aspx

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 Axxxx 的頭像
    Axxxx

    Axxxx

    Axxxx 發表在 痞客邦 留言(0) 人氣()