I have an IEnumerable<string>
being passed to me which has the following items:
- HP
- Canon
- Lexmark
- Samsung
- Other
Now what I am trying to achieve is order the items alphabetically but I want to keep the other
item last. I have gone ahead and used OrderBy(i => i)
which lists the items as follows:
- Canon
- HP
- Lexmark
- Other
- Samsung
The desired result I want is
- Canon
- HP
- Lexmark
- Samsung
- Other
I have tried using .OrderBy(i => i != "Other").ThenBy(i => i)
but this puts Other
item right at the top.
Can someone tell me how to achieve this please.