Note, that reversing a and b like so...
list.Sort((b, a) =>
...here will reverse the order. If FriendlyName held a string value for the names of the three (four) stooges, then then their names would end up sorted in a decending manner like so:
- Shemp
- Moe
- Larry
- Curly
However they would come out in the original example like this:
- Curly
- Larry
- Moe
- Shemp
Get it? If another sort statement came before the stooge sorting then the collection would primarily be sorted by FriendlyName and secondarily be sorted by the other item.
No comments:
Post a Comment