【发布时间】:2010-09-12 22:26:21
【问题描述】:
我想用 Linq 的 Aggregate 函数制作一个逗号分隔值字符串。有人知道怎么做吗?
给定一个这样的字符串数组:
var authors = new string[] {"author 1", "author 2", "author 3"};
如何获得像 author 1, author 2, author 3 这样的单个字符串?
我在想authors.Aggregate(author => author + ",") 之类的东西可能可以做到这一点,但不确定。
想法?
【问题讨论】:
标签: .net linq string csv aggregate