Linq to find the maximum value of List <List <int>>?
2 answers
You can use SelectMany() for this, which aligns the nested list, then you can just take the maximum of the resulting sequence:
int maxValue = values.SelectMany( x => x).Max(); +12
You can use SelectMany() for this, which aligns the nested list, then you can just take the maximum of the resulting sequence:
int maxValue = values.SelectMany( x => x).Max();