填写缺失的部分以执行一些代码,在异常语句之后,无论结果如何。
@(3) { int[] myNumbers = {1, 2, 3}; Console.WriteLine(myNumbers[10]); } @(5) (Exception e) { Console.WriteLine("Something went wrong."); } @(7) { Console.WriteLine("The 'try catch' is finished."); }
try { int[] myNumbers = {1, 2, 3}; Console.WriteLine(myNumbers[10]); } catch (Exception e) { Console.WriteLine("Something went wrong."); } finally { Console.WriteLine("The 'try catch' is finished."); }