Stravaig-Projects / Stravaig.Extensions.Core

A set of small extensions to make life a little easier.
MIT License
0 stars 0 forks source link

IEnumerable<T>.OrderBySelf() #28

Open colinangusmackay opened 1 year ago

colinangusmackay commented 1 year ago

It can be common to simply order a result by itself. e.g.

int[] a = new[] {1, 5, 9, 2, 4, 3, 7, 8, 0};
var ordered = a.OrderBy(b => b);

Could collapse this into an OrderBySelf() with a variants that order descending, and variants that take an IComparer. Also the ThenBy/ThenByDescending variants too.

colinangusmackay commented 1 year ago

Maybe just .Ordered() or .OrderedDescending()?