C# 在try中写了return,后面又写了finally,是先执行return还是先执行fianlly
namespace ConsoleApp1
{
internal class Program
{
public static void Main(string[] args)
{
System.Console.WriteLine(test());
System.Console.ReadKey();
}
public static bool test()
{
try
{
//用来检测try块里面处于return前的语句是否有被执行
System.Console.WriteLine("此时在try中执行...");
return false;
}
finally
{
System.Console.WriteLine("此时finally语句块正在被执行...");
}
}
}
}