try
{
// Code to try goes here.
int a = Convert.ToInt32("123a5");
Console.WriteLine("结果:" + a);
}
catch (Exception ex)
{
// Code to handle the exception goes here.
// Only catch exceptions that you know how to handle.
// Never catch base class System.Exception without
// rethrowing it at the end of the catch block.
Console.WriteLine("出错:" + ex,Message);
}
C# 异常
最新推荐文章于 2024-07-15 09:40:27 发布