13 ms·
The other reason those Parallel methods did use async/await is that async/await did not exist in .NET at the time those methods were introduced. But good news!
by MarkSweep 5y ago
The other reason those Parallel methods did use async/await is that async/await did not exist in .NET at the time those methods were introduced.
But good news! The upcoming .NET 6 release will have a Parallel.ForEachAsync method:
https://docs.microsoft.com/dotnet/api/system.threading.tasks.parallel.foreachasync https://docs.microsoft.com/dotnet/api/system.threading.tasks...
- torginus 5y agoDoing a bit of .NET archeology we find that both Task<T> and Parallel.For can be dated to .NET 4.0 So if they wanted to, they could've included async/await support. It just didn't make sense.
- ridethebike 5y agoAsync/await were officially added to c# 5 and .net framework 4.5 I think it was possible to have async/await in .net framework 4.0 via some workarounds when it was still in CTP mode but I don't recall the details.