Mark expressions as unchecked : Unchecked : Data Type C# Examples


C# Examples » Data Type » Unchecked »

 

Mark expressions as unchecked









    
using  System;

class  MainClass
{
        public  static  void  Main()
        {
                unchecked
                {
                        byte  a  =  55;
                        byte  b  =  210;
                        byte  c  =  (byte)  (a  +  b);
                }
        }
}
    
   
  
   



Output

Unhandled Exception: System.OverflowException: Arithmetic operation resulted in an overflow.
   at MainClass.Main()


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Type
» Unchecked