Lexicographically sorted list of lists of strings

前端 未结 4 1573
轻奢々
轻奢々 2021-01-19 05:39

Currently, I am trying to implement a code to generate frequent sequences. In doing so I need to get an in-place sort of a list of lists of strings as follows:



        
4条回答
  •  心在旅途
    2021-01-19 06:28

    How about :

    myList = myList.OrderBy(s => string.Join(string.Empty, s)).ToList();
    

    The trick is to sort according to the string made by the concatenation of each element of the child list.

提交回复
热议问题