会执行,在return前执行。 - using System;
- namespace test4
- {
- internal class Program
- {
- static string x;
- private static void Main(string[] args)
- {
- Console.WriteLine(Method());
- Console.WriteLine(x);
- Console.ReadKey();
- }
- static string Method()
- {
- try
- {
- x = "try";
- return x;
- }
- finally
- {
- x = "finally";
- }
- }
- }
- }
复制代码
|