blob: 4c345dad5809eb3b423c5abae8e986bea6608c84 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
class C
{
private IEnumerable<string> Test (string s)
{
Func<Task<string>> a = async () => await Task.FromResult(s + "a");
yield return a ().Result;
}
private IEnumerable<string> Test2 ()
{
var s = "bb";
Func<Task<string>> a = async () => await Task.FromResult(s + "a");
yield return a ().Result;
}
public static int Main ()
{
var c = new C ();
string res = "";
foreach (var e in c.Test ("tt"))
res += e;
if (res != "tta")
return 1;
res = "";
foreach (var e in c.Test2 ())
res += e;
if (res != "bba")
return 2;
return 0;
}
}
|