Custom line sorter

I want to sort the collection with one of the properties, which is a string, but I don't want to sort in alphabetical order.

Here is my code

 IEnumerable<Item> items = Repository.Query<Item>().OrderBy(r=> r.Status)

Status is a string, but I want to sort in a specific order (not in alphabetical order)

how do I insert a custom sorter in the syntax above.

+3
source share
1 answer

When ordering, it has an overload that accepts IComparer.
Take a look here .

+7
source

Source: https://habr.com/ru/post/1750998/


All Articles