【发布时间】:2015-09-13 06:50:15
【问题描述】:
我想要实现的是按字母顺序排列的嵌套列表。
例如我的意见:
fat, twat, gat //Line 1
cat, hat, bat // Line 2
twat, lack, rat // Line 3
我希望输出是:
bat, cat, hat // Line 2
fat, gat, twat // Line 1
lack, rat, twat // Line 3
如您所见,列表首先在内部排序,然后在外部排序。
我目前的实现是使用嵌套列表:
List<List<String>> testSort;
我已经设法使用这种方法对内部列表进行了排序:
public static List<List<String>> sortList(List<List<String>> input)
{
input.ForEach(delegate (List<string> o)
{
o.Sort();
});
return input;
}
我现在不确定如何对外面的列表进行排序。帮助将不胜感激!
提前致谢!
【问题讨论】: