By alphabetically by length I mean as follows:
given:
{ “=”, “==>>”, “=>>”, “=>”, “!>” }
I want to get out:
!>
=
=>
=>>
==>>
I’m currently just using OrderBy(x => x.Length).ToArray()
anyone got a better lambda?
Is this reasonably possible? lol, I’m not sure what the rule conventions here would be 🙁
Writing your own string comparer you can do this, which meets both set of requirements you’ve posted.
a bcde bcd b bced cb
would yield:
a b bcd bcde bced cb
and { “=”, “==>>”, “=>>”, “=>”, “!>” }
yields:
by calling:
myStringCollection.OrderBy(x=>x, new MyStringComparer).ToArray();