This blog is moved to
http://amalhashim.wordpress.com

Saturday, February 28, 2009

C# 4.0 - New extension method "Zip"

List<string> names = new List<string>

{"amal", "asif", "munna" , "arif", "sabith" };

List<int> ages = new List<int>{ 25, 20, 15, 12, 10 };

var zipped = names.Zip(ages, (name, age) => name + " is " + age + " years old.");

foreach (var item in zipped)

{

Console.WriteLine(item);

}

No comments: