【发布时间】:2019-01-07 12:51:08
【问题描述】:
我的 Unity 应用程序中有一个字典列表,如下所示:
public static List<Dictionary<string, object>> offers = new List<Dictionary<string, object>>();
在这个列表中,我存储了我的 firebase 数据库中的一些值,它看起来像这样:
List[0]
Store: "storeName"
Img: "ImageURL"
Distance: 600
List[1]
Store: "storeName1"
Img: "ImageURL1"
Distance: 30
现在我想在最低“距离”值之后对我的列表进行排序,但我不太清楚如何在这种情况下使用 .Sort() 。谁能帮帮我?
【问题讨论】:
-
你试过 OrderBy 了吗? var sortedOffers = offer.OrderBy(x => x.Values.Distance).ToList();
标签: c# list sorting dictionary unity3d