填写缺失的部分,以便在发生错误时输出错误消息。
@(3) { int[] myNumbers = {1, 2, 3}; Console.WriteLine(myNumbers[10]); } @(5) (Exception e) { Console.WriteLine(e.Message); }
try { int[] myNumbers = {1, 2, 3}; Console.WriteLine(myNumbers[10]); } catch (Exception e) { Console.WriteLine(e.Message); }