0

I am using ZIP to create a tuple of 3 lists as:

var result = l1
  .Zip(l2)
  .Zip(l3);

But then each item I get is something like:

((l11, l21), l31)

How to use Zip to create IEnumerable of Tuples from N lists where each item would become:

(l11, l21, l31, l41, ...)
Miguel Moura
  • 36,732
  • 85
  • 259
  • 481
  • 2
    You'd have to do something like `l1.Zip(l2).Zip(l3, (x, y) => (x.Item1, x.Item2, y)).Zip(l4, (x, y) => (x.Item1, x.Item2, x.Item3, y))` and so on. I don't think there's a simple way to turn a n tuple into a n+1 tuple. – juharr May 14 '21 at 19:17
  • 1
    I think [this SO question](https://stackoverflow.com/questions/10297124/how-to-combine-more-than-two-generic-lists-in-c-sharp-zip) might help you. – Brian Berns May 14 '21 at 19:42

0 Answers0