LINQ zip

来源:互联网 发布:排列组合公式算法例题 编辑:程序博客网 时间:2024/05/29 02:01
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace zip{    class Program    {        static void Main(string[] args)        {            int[] numbers = { 3, 5, 7 };            string[] words = { "three", "five", "seven", "ignored" };            IEnumerable<string> zip = numbers.Zip(words, (n, w) => n + "=" + w);            foreach (var z in zip)            {                Console.WriteLine(z);            }            Console.ReadKey();        }    }}

0 0