Sorting a SortedDictionary based on value, not key

后端 未结 4 606
猫巷女王i
猫巷女王i 2021-01-18 18:11

I have a SortedDictionary, the key is a int value and the matching value to each key is a class object. The class contains a int and a two datetime variable.

I need

4条回答
  •  旧时难觅i
    2021-01-18 18:53

    You could use a Linq query.

    var D = new SortedDictionary();
    var qD = from kvp in D
             orderby kvp.Value
             select kvp
    ;
    

提交回复
热议问题