65,210
社区成员
发帖
与我相关
我的任务
分享
try
{
//...
}
catch(...)
{
//...
}
// try_catch_finally.cs
using System;
public class EHClass
{
static void Main()
{
try
{
Console.WriteLine("Executing the try statement.");
throw new NullReferenceException();
}
catch (NullReferenceException e)
{
Console.WriteLine("{0} Caught exception #1.", e);
}
catch
{
Console.WriteLine("Caught exception #2.");
}
finally
{
Console.WriteLine("Executing finally block.");
}
}
}
try
{
}
catch
{
}
及
try
{
}
catch
{
}
Finally
{
}