【发布时间】:2014-07-10 21:25:21
【问题描述】:
假设我有 2 个列表
List<string> list1 = new List<string>;
list1.Add("one");
list1.Add("three");
list1.Add("five");
List<string> list2 = new List<string>;
list2.Add("two");
list2.Add("four");
list2.Add("six");
我怎样才能合并它们(技术上不是连接),以便我可以得到一个包含值的新列表:
[one two] [three four] [five six]
请注意,'[' 和 ']' 分隔最终列表中的每个字符串。所以列表中的第一个值是“一二”,第二个值是“三四”,第三个值是“五六”。
我希望我解释清楚了。
【问题讨论】:
-
好像你在找
Enumerable.Zip()。 -
@HighCore 正是我所需要的。谢谢。