Alex Rivera | Logout

How to do Python's zip in C#?

Asked 2010-03-11T17:02:04.720
25

Python's zip function does the following:

a = [1, 2, 3]
b = [6, 7, 8]
zipped = zip(a, b)

result

[[1, 6], [2, 7], [3, 8]]
Edit
Report

1 Answer

2

Also take a look at Cadenza which has all sorts of nifty utility methods.

Specifically look at the Zip extension methods under Cadenza.Collections.EnumerableCoda.

answered 2010-03-11T17:12:17.060

Your Answer