Fermium-co/LINQ4ES2015

Support OrderBy

mahdiehsanifar opened this issue · 2 comments

Hi, Guys
That's a cool idea!

It would be great if you could add the "order by" methods including:
OrderBy
OrderByDescending
ThenBy
ThenByDescending

Thanks in advance.

You can fix your problem temporarily using following approach: item.firstName + item.lastName

let complexArr = [{ firstName: 'C', lastName: 'D' }, { firstName: 'A', lastName: 'C' }, { firstName: 'A', lastName: 'B' }];
let orderedItems = complexArr.asEnumerable().orderBy(item => item.firstName + item.lastName).toArray();

Result:

[{"firstName":"A","lastName":"B"},{"firstName":"A","lastName":"C"},{"firstName":"C","lastName":"D"}]
msynk commented

Implementing thenBy and thenByDescending with the current approach is almost impossible. But we are NOT disappointed and working on it.