what is the LINQ way of doing a pivot such that rows are trasposed to one string?
e.g.
a select producing:
a
b
c
would appear a开发者_运维百科s:
a,b,c
That sounds like you just want string.Join
:
var results = string.Join(",", values);
No need for LINQ at all. Note that .NET 4 has more overloads for string.Join
than earlier versions - so if you're using .NET 3.5 you may need something like:
var results = string.Join(",", values.Select(x => x.ToString()).ToArray());
精彩评论