Is there a way to reduce an iterable object to a single value? In javascript this can be done like so:
var array = [{num: 1}, {num: 10}, {num: 5}];
var result = array.reduce((cur, val) => val.num > cur ? val.num : cur, 0);
console.log(result);
The above will return the largest number in the array of objects.
Currently in C#
I am using a foreach
to find the largest item, but is there a built in function similar to the javascript reduce
method from above?