try
{
object bj = null;
if (obj is Nullable)
{
//throw引发异常,就会在代码块中匹配查找catch异常处理块。就去执行相区配的catch异常处代码块
throw new System.Exception();//throw异常对象,new ;throw主动引发异常
}
int n = (int)obj;
}
catch (System.Exception ex)
{
MessageBox.Show("捕获异常" + ex.Message);
}
finally //finally必须执行,一般用于释放占用系统的资源
{
this.Close();//关闭窗体
}