public void main(string[] args)
{
Byte b = 255;
checked
{
b++;
}
Console.WriteLine(b.ToString());
}
Results:
Unhandled Exception :System.OverflowException:Arithmetic opertation resulted in an overflow at ...;
if you want to forbid it to run
just change checked to Unchecked
Of course The Results Will Lost Date,The Result is Zero;
转载于:https://www.cnblogs.com/ComeOn/archive/2007/04/02/697092.html