|
by ssmith via Blog on 9/6/2009 4:39:00 AM
The LINQ Aggregate() extension method uses a Func<int, int, int> to operate on items in a series. If you want to use it, for example, to return the product of each value with its successor, you can do something like this: Func<int, int, int> producter = (one, two) => one * two;
var result = subString.ToCharArray().ToDigits().Aggregate(producter);
Of course, you don’t need the intermediate value. You can simply use a lambda directly for the Aggregate
... [ read more ]
|
|