string[] brands = new string[] { "BMW", "Mercedes", "Audi" }; string[] websites = new string[] { "www.bmw.com", "www.mercedes.com", "www.audi.com" }; var output = brands.Zip(websites, (b, w) => string.Format("{0} can be found at {1}", b, w)); foreach (var line in output) Console.WriteLine(line);
This gives you:
BMW can be found at www.bmw.com Mercedes can be found at www.mercedes.com Audi can be found at www.audi.com
More information at: http://msdn.microsoft.com/en-us/library/dd267698.aspx
Advertisements