2 using System
.Threading
.Tasks
;
8 static async Task
<int> YieldValue (int a
)
14 static async Task
<int> TestFinallyWithReturn (int value)
22 Console
.WriteLine ("try");
25 Console
.WriteLine ("finally");
26 value += await YieldValue (100);
30 Console
.WriteLine ("over");
35 static async Task
TestFinallyWithReturnNoValue (int value)
43 Console
.WriteLine ("try");
46 Console
.WriteLine ("finally");
47 value += await YieldValue (100);
51 Console
.WriteLine ("over");
54 static async Task
<int> TestFinallyWithGoto (int value)
62 Console
.WriteLine ("try");
65 Console
.WriteLine ("finally");
66 value += await YieldValue (100);
70 Console
.WriteLine ("over");
74 static async Task
<int> TestFinallyWithGotoAndReturn (int value)
82 Console
.WriteLine ("try");
87 Console
.WriteLine ("finally");
88 value += await YieldValue (100);
92 Console
.WriteLine ("over");
96 public static int Main ()
98 if (TestFinallyWithReturn (9).Result
!= 5)
104 if (TestFinallyWithReturn (1).Result
!= 1111)
110 TestFinallyWithReturnNoValue (9).Wait ();
114 TestFinallyWithReturnNoValue (1).Wait ();
118 if (TestFinallyWithGoto (9).Result
!= 109)
124 if (TestFinallyWithGoto (1).Result
!= 1111)
130 if (TestFinallyWithGotoAndReturn (9).Result
!= 109)
136 if (TestFinallyWithGotoAndReturn (1).Result
!= 1111)
142 if (TestFinallyWithGotoAndReturn (3).Result
!= 9)
148 Console
.WriteLine ("ok");