We declare 2 string arrays. Then, we invoke the Zip method. The first argument to the Zip method is the secondary array we want to process in parallel.
using System;
using System.Linq;
// Two source arrays.
var array1 = new string[] {
"blue",
"red",
"green" };
var array2 = new string[] {
"sky",
"sunset",
"lawn" };
// Concatenate elements at each position together.
var zip = array1.Zip(array2, (a, b) => (a +
"=" + b));
// Look at results.
foreach (var value in zip)
{
Console.WriteLine(
"ZIP: {0}", value);
}
ZIP: blue=sky
ZIP: red=sunset
ZIP: green=lawn