Mega Code Archive

 
Categories / C# Tutorial / Data Type
 

A Checked Block Example

public class Program {   public static void Main()   {       checked       {           // int.MaxValue equals 2147483647           int n = int.MaxValue;           n = n + 1 ;           System.Console.WriteLine(n);       }   } }