static void Main(string[] args)
{
int[] myint = {0,1,2,3,4,5,6,7,8,9,10 };
try
{
for (int i = 0; i <= myint.Length; i++)
{
int temp = 720 / myint[i];
}
}
catch (Exception myexc)
{
Console.WriteLine(myexc.Message.ToString());
}
finally
{
Console.WriteLine("无论发生错误与否,都执行fanally语句");
}
Console.ReadKey();
}
C#异常捕获,try..catch..finally
最新推荐文章于 2024-10-07 23:22:21 发布