checked 和 unchecked

1、检查是否有内存溢出
int a=200;
byte b=checked(byte(a+100));//b的值是44,抛出异常
2、checked语句
checked
{
   int a=200;
   byte b=checked(byte(a+100));//b的值是44,抛出异常
}
3、注意在checked语句中
checked
{
   int a=200;
   byte b=checked(byte(a+100));//b的值是44,抛出异常
   IncludeOverFlow();//包含溢出,单不会抛出异常
}
原文地址:https://www.cnblogs.com/kuailewangzi1212/p/717649.html