// Maximum Limit of Short integer.
short shorty = 32767;
int integer = shorty + 1;
try
{
// force compiler to object
checked
{
// try to cast it into a short
shorty = (short)integer;
}
}
catch (OverflowException e)
{
//"Arithmetic operation will raise overflow error."
Console.WriteLine(e.Message);
}