Key code meanings
• try code that may be wrong
• catch the code to be executed when an error occurs. Once the program goes wrong, the catch will have an error object, the type is Exception
• finally code that must be executed if there is no error
Code display
try{
//不出错时执行的代码
}catch(Exception e){
Console.WriteLine(e);//输出错误原因e
}finally{
Console.WriteLine("程序结束");//出不出错都要执行的代码
}