How to write
string result = strings.开发者_StackOverflow社区Aggregate(new StringBuilder(), (s, a) => s.AppendLine(a)).ToString();
in from a in strings select ...
form?
You can't. See here for a list of LINQ query keywords:
http://msdn.microsoft.com/en-us/library/bb310804.aspx
However you do it you'd still need to call a method (Aggrigate
).
How about a solution without the need for Aggregate at all:
string[] strings = {"1", "2", "3"};
string result = String.Join("\r", strings);
精彩评论