1. 程式人生 > >2017-11-01 C# trycatch&

2017-11-01 C# trycatch&

finally tel style exception line cat size final amp

try{

  //無論如何都會走,必須寫;

}

catch(Exception a){  //Exception報異常,需要定義,需要寫輸出語句;

  //如果上面執行失敗走,必須寫;

  Console.writeLine(a);

}

finally{

  //無論如何都會執行的語句,可以不寫;

}

順序在執行。

2017-11-01 C# trycatch&