METHOD

Enumerable.Zip

Pairs corresponding positions rather than comparing keys. Enumeration ends when either sequence is exhausted; unmatched trailing elements are not returned.

Formal Syntax & Structure

csharp syntaxcsharp
left.Zip(right, resultSelector)

Working Example

Example Snippetcsharp
using System;using System.Collections.Generic;using System.Linq;Console.WriteLine(string.Join(",", new[] { 2, 4, 8 }.Zip(new[] { 10, 20 }, (x,y) => x+y))); // 12,24
C# & .NET Reference