Skip to main content
D G's user avatar
D G's user avatar
D G's user avatar
D G
  • Member for 13 years
  • Last seen this week
Stats
563
reputation
373k
reached
12
answers
39
questions
Loading…
About
static async Task Main()
{
    var f = async (char c) =>
    {
        for (int i = 0; i < 5; ++i)
        {
            Console.WriteLine(c);
            await Task.Yield();
        }
    };

    Console.WriteLine("Begin");
    var a = f('*');
    var b = f('-');
    await Task.WhenAll(a, b);
    Console.WriteLine("End");
}

and

async function Main() {
    let f = async (c) => {
        for (let i = 0; i < 5; ++i) {
            console.log(c)
            await Promise.resolve();
        }
    }
    console.log('Begin');
    const a = f('*');
    const b = f('-');
    await Promise.all([a, b]);
    console.log('End');
}
This user doesn’t have any gold badges yet.
5
silver badges
14
bronze badges
1
Score
27
Posts
53
Posts %
1
Score
8
Posts
16
Posts %
1
Score
6
Posts
12
Posts %
0
Score
17
Posts
33
Posts %
0
Score
7
Posts
14
Posts %
0
Score
6
Posts
12
Posts %