你能帮助我了解更多的细节,需要对Enumerable.Aggregate功能
words.Aggregate((workingSentence, next) => + next + " " + workingSentence);
从下面的代码片段
?如果有人解释我在C#1.1中实现这一点,那将会很棒。
(摘录自MS) -
string sentence = "the quick brown fox jumps over the lazy dog";
// Split the string into individual words.
string[] words = sentence.Split(' ');
// Prepend each word to the beginning of the
// new sentence to reverse the word order.
string reversed = words.Aggregate((workingSentence, next) =>
next + " " + workingSentence);
Console.WriteLine(reversed);
// This code produces the following output:
//
// dog lazy the over jumps fox brown quick the
感谢和清楚,我会尝试更多的例子基于此。还要感谢Gabe和Will。 – paragy 2010-11-15 13:51:14