Can you help me to understand,
words.Aggregate((workingSentence, next) => + next + " " + workingSentence);
from below code snippet? and it would be great if someone explain me to achive this in C# 1.1.
(Snippet From 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
The
Aggregatepart of your example translates to something roughly like this:The
workingSentencevariable is an accumulator that is updated on each iteration of the loop by applying a function to the existing accumulator value and the current element of the sequence; this is performed by the lambda in your example and by the body of theforeachloop in my example.