Custom sort logic in OrderBy using LINQ

后端 未结 3 1010
时光取名叫无心
时光取名叫无心 2020-11-29 04:01

What would be the right way to sort a list of strings where I want items starting with an underscore \'_\', to be at the bottom of the list, otherwise everything is alphabet

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-29 04:35

    I think you need to use OrderBy(Func<>, IComparer<>) and specify your own Comparer which will implement your custom logic .

提交回复
热议问题