I have three string arrays. I want to combine them using zip in linq. How to do?
arr1.Zip(arr2, (a1, a2) => a1 + a2);
How to add arr3?
I have three string arrays. I want to combine them using zip in linq. How to do?
arr1.Zip(arr2, (a1, a2) => a1 + a2);
How to add arr3?
You can use Zip again:
arr1.Zip(arr2, (a1, a2) => new { a1, a2 })
.Zip(arr3, (a12, a3) => a12.a1 + a12.a2 + a3)
or
arr1.Zip(arr2, (a1, a2) => a1 + a2)
.Zip(arr3, (a12, a3) => a12 + a3)
The former version avoids one extra string concatenation.
Never mind. I found the answer here
Combine Multiple Sequences in LINQ using the Zip Operator - .NET 4.0