4 ms·
They could at least introduce a new language construct like await synchronizedAsync(lock) { // some code } C# introduced: a
by skyde 3y 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();
}