Look at type
catch (System.OverflowException e)
{ ...
e is my variable name it is short for exception. It is not obligatory to use any name if you wanna catch OverflowException without more information.
Look at type
catch (System.OverflowException e)
{ ...
e is my variable name it is short for exception. It is not obligatory to use any name if you wanna catch OverflowException without more information.
Use
checked
Like in example bellow:
try
{
// The following line raises an exception because it is checked.
z = checked(maxIntValue + 10);
}
catch (System.OverflowException e)
{
// The following line displays information about the error.
Console.WriteLine("CHECKED and CAUGHT: " + e.ToString());
}