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

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

class X
{
        public static void Main ()
        {
                new X ().Foo ().Wait ();
        }

        async Task Foo ()
        {
                await Task.Run (async () => {
                        for (var count = 1; count < 5; count++) {
                                Invoke (() => {
                                        Console.WriteLine ("{0}", count);
                                });
                        }
                });
        }

        void Invoke (Action a)
        {
                a ();
        }
}