C# Sorting list by another list

前端 未结 4 1119
情书的邮戳
情书的邮戳 2020-12-21 23:33

I have now 2 lists:

list names;
list numbers;

and I need to sort my names based on the values in numbers. I\'ve be

4条回答
  •  天涯浪人
    2020-12-21 23:56

    I fixed it by doing it with an dictionary, this was the result:

    dictionary.OrderBy(kv => kv.Value).Reverse().Select(kv => kv.Key).ToList();
    

提交回复
热议问题