例如,我有一个列表:
[0] daniel
[1] moses现在是第二个列表:
[0] hello world
[1] hi everyone我想要构建一个新的字符串列表,它将是:
[0] daniel hellow world
[1] moses hi everyone我该怎么做呢?
发布于 2012-08-12 04:26:45
您可以使用LINQ Zip方法:
var result = first.Zip(second, (f, s) => string.Format("{0} {1}", f, s));发布于 2012-08-12 04:26:37
你可以使用Linq / :
var list1 = new List<string>() {"daniel", "moses"};
var list2 = new List<string>() { "hello world", "hi everyone" };
var resultList = list1.Zip(list2, (a, b) => a + " " + b)
.ToList();https://stackoverflow.com/questions/11917360
复制相似问题