如何将以下字典转换为频道对象列表?我尝试了ToList()方法,但我似乎无法让它工作。
List<Items> items = new List<Items>();
Dictionary<int, Items> foundItems =
statsCont.OrderByDescending(x => x.Value.NumberOfItems)
.Take(10)
as Dictionary<int, Items>;
答案 0 :(得分:8)
你试过了吗?
foundItems.Values.ToList();
答案 1 :(得分:1)
怎么样:
List<Items> items = statsCont.OrderByDescending(x => x.Value.NumberOfItems)
.Take(10)
.Select(x => x.Value)
.ToList();