D G

404
reputation
class Program
{
    public readonly IList<int> data = [1, 2, 3];
    static void Main(string[] args)
    {
        var p = new Program()
        {
            data = { 4, 5, 6 } // appending :-)
        };
        Console.WriteLine(string.Join(",", p.data));
    }
}
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');
}