I have a code in async that looks like this:
List<Task<(decimal, decimal)?>> tasks = offsets
.Zip(prices, async (offset, price) => await Func(offset, price));
(decimal, decimal)?[] result = await Task.WhenAll(tasks);
And I would like to use Parallel instead.
but
ParallelLoopResult result1 = Parallel.ForEachAsync(
offsets.Zip(prices, (offset, price) => await Func(offset, price));
does not work as foreach takes only 1 argument. Any idea how I could do that please?
This should compile:
It uses this
Parallel.ForEachAsyncoverload: