什么是LINQ的使用Enumerable.Zip扩展方法吗? [英] What is the use of Enumerable.Zip extension method in Linq?
本文介绍了什么是LINQ的使用Enumerable.Zip扩展方法吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有什么用 Enumerable.Zip
的Linq中扩展方法?
What is the use of Enumerable.Zip
extension method in Linq?
推荐答案
的ZIP运营商合并使用指定的选择器功能两个序列的相应元素。
The Zip operator merges the corresponding elements of two sequences using a specified selector function.
var letters= new string[] { "A", "B", "C", "D", "E" };
var numbers= new int[] { 1, 2, 3 };
var q = letters.Zip(numbers, (s, i) => s + i.ToString());
foreach (var s in q)
Console.WriteLine(s);
输出继电器
A1
B2
C3
这篇关于什么是LINQ的使用Enumerable.Zip扩展方法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文