Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test-async-84.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 03825613f1f61ac9f4ed86652e5b373750dbf0d0 (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
using System;
using System.Threading.Tasks;

struct S
{
	public int value;
	public string str;
}

public class Program
{
	async Task<S> Foo ()
	{
		return new S {
			value = 1,
			str = await DoAsync ()
		};

	}

	static async Task<string> DoAsync ()
	{
		await Task.Yield ();
		return "asdafs";
	}

	static int Main ()
	{
		var res = new Program ().Foo ().Result;
		if (res.value != 1)
			return 1;

		return 0;
	}
}