This is because, by default, C # does not throw any exceptions for integer overflows, as well as for the lower stream. Here you can do a couple of things.
Option 1
You must allow the exception by going to Project => properties => Insert tab => Advanced => check the arithmetic overflow of the stream (make sure you check the box)

Make sure you check the box
Option 2
Use the marked block and eliminate the overflow exception to handle the situation. An example code snippet would be
try { checked { int y = 1000000000; short x = (short)y; } } catch (OverflowException ex) { MessageBox.Show("Overflow"); } catch (Exception ex) { MessageBox.Show("Error"); }
Hope this helps you ... :)
oshan2csd Apr 02 '15 at 8:11 2015-04-02 08:11
source share