Home  »  Code Snippets  »  LINQ  »

ZIP Operator in LINQ

 Posted By : Gopesh SharmaPosted Date : 09/10/2012 10:26:53 AM Category : LINQ Points : 3

string[] s = { "z", "y", "x", "u" };

int[] number = { 10, 9, 8, 7 };
var query = s.Zip(number, (n, w) => n + "," + w);
foreach ( var item in query )
{
Console.WriteLine(item);
}

Output
z,10
y,9
x,8
u,7

 

Responses
No responses found for this thread. Be the first to respond this thread.
Post Reply
Login to post Response.