using System;
public class Program
{
public static void Main()
//If you have several statements that you want to check, you can make a checked block like below:
long a = 9999999999;
long b = long.MaxValue;
checked
int a1 = (int)a; // OverflowException
int b1 = (int)b; // OverflowException
}