2
当我把SecondMain()
里面的尝试blcok secondMain()
内的最后一块正在执行。但是当我把它放在外面的时候它并没有执行。为什么它不执行?C#最后的块没有执行时,抛出异常抛出
static void Main(string[] args)
{
try
{
SecondMain(args); //try putting
Console.WriteLine("try 1");
throw new Exception("Just fail me");
}
finally
{
Console.WriteLine("finally");
}
}
static void SecondMain(string[] args)
{
try
{
throw new StackOverflowException();
}
catch (Exception)
{
Console.WriteLine("catch");
throw;
}
finally
{
Console.WriteLine("finally");
}
}