Tuesday, May 11, 2010

Zip Extension

Today i was going through some of the blogs.I have seen the Zip extension method in .Net 4.0 .
I like this very much here is the one sample example of Zip extension.

int[] numberArray = { 0, 1, 2, 3, 4 };
string[] nameArray = { "zero", "one" };

var combinedArray = numberArray.Zip(nameArray, (number, name) => number.ToString() + "(" + name + ")").ToArray();

Array.ForEach(combinedArray, s => Console.WriteLine(s));

0 comments:

 
Counter