Is there any LINQ support for checking if an IEnumerable is sorted? I have an enumerable that I want to verify is sorted in non-descending order, but I
IEnumerable
There is a short and simple version using Zip, although your IEnumerable does get enumerated twice.
var source = Enumerable.Range(1,100000);
bool isSorted = source.Zip(source.Skip(1),(a,b)=>b>=a).All(x=>x);