再发生异常后,保持对程序的控制力
using System;
using System.Collections.Generic;
using System.Text;
namespace 异常捕获
{
class Program
{
static void Main(string[] args)
{
int a = 1;
int b = 0;
try
{
a = a / b;
}
catch (System.DivideByZeroException e)
{
Console.WriteLine(e.Message);
}
}
}
}
using System.Collections.Generic;
using System.Text;
namespace 异常捕获
{
class Program
{
static void Main(string[] args)
{
int a = 1;
int b = 0;
try
{
a = a / b;
}
catch (System.DivideByZeroException e)
{
Console.WriteLine(e.Message);
}
}
}
}
肩负责任,永不退缩