DEV Community

Discussion on: Introduction to functional programming with C#

Collapse
 
simonsabin profile image
Simon Sabin

Your code has a huge flaw in that you aren't outputting what is being calculated. You are outputting the index of the item being multiplied, not the actual value being multiplied.

public static List<string> Format(List<int> list)
    => list.AsParallel()
    .Select(Extensions.MultiplyBy2)
    .Zip(list.AsParallel(), (result, item) => $"{item} x 2 = {result}")
    .ToList();
Enter fullscreen mode Exit fullscreen mode