Mark expressions as unchecked : unchecked « Data Type « C# / CSharp Tutorial






using System;

class MainClass
{
    public static void Main()
    {
        unchecked
        {
            byte a = 55;
            byte b = 210;
            byte c = (byte) (a + b);
        }
    }
}
Unhandled Exception: System.OverflowException: Arithmetic operation resulted in an overflow.
   at MainClass.Main()








2.49.unchecked
2.49.1.Mark expressions as unchecked
2.49.2.An Unchecked Block Example
2.49.3.unchecked marker
2.49.4.Overflow the max value of a System.Byte