I\'m interested if there is a way, in LINQ, to check if all numbers in a list are increasing monotonically?
Example
List l
Would you not order the list using OrderBy()
and compare them against the original? If they are the same then it will give your your answer pseudo speaking:
var increasing = orignalList.OrderBy(m=>m.value1).ToList();
var decreasing = orignalList.OrderByDescending(m=>m.value1).ToList();
var mono = (originalList == increasing || originalList == decreasing)