Hacker News new | ask | show | jobs
by skyde 871 days ago
They could at least introduce a new language construct like await synchronizedAsync(lock) { // some code }

C# introduced:

       await foreach (int item in RangeAsync(10, 3))

       Console.Write(item + " "); // Prints 10 11 12

So you dont have to type:

IAsyncEnumerator<int> e = RangeAsync(10, 3).GetAsyncEnumerator();

  try {

    while (await e.MoveNextAsync()) Console.Write(e.Current + " ");

  } finally { 

    if (e != null) await e.DisposeAsync(); 

  }