Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Linq/.NET3.5 support a 'zip' method?

In other languages (ruby, python, ...) I can use zip(list1, list2) which works like this:

If list1 is {1,2,3,4} and list2 is {a,b,c}

then zip(list1, list2) would return: {(1,a), (2,b), (3,c), (d,null)}

Is such a method available in .NET's Linq extensions?

like image 642
Cristian Diaconescu Avatar asked May 11 '10 15:05

Cristian Diaconescu


1 Answers

.NET 4 gives us a Zip method but it is not available in .NET 3.5. If you are curious, Eric Lippert provides an implementation of Zip that you may find useful.

like image 95
Andrew Hare Avatar answered Sep 30 '22 21:09

Andrew Hare