static void CheckedUnCheckedDemo() { int i = int.MaxValue; try { //checked //{ // Console.WriteLine(i + 1); //} unchecked { Console.WriteLine(i + 1); } } catch(OverflowException ex) { Console.WriteLine(ex.Message); } }
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/67172.html
標籤:C#
上一篇:The finally block does not always execute in try finally
下一篇:VS 2019中修改C#語言版本
