Dictionary d_Last10Mins_RQIM = new Dictionary();
d_Last10Mins_RQIM.Add("1", 10.0);
d_Last10Mins_RQIM.Add("2", 20.0);
d_Last10Mins_RQIM.Add("3", 30.0);
d_Last10Mins_RQIM.Add("4", 90.0);
d_Last10Mins_RQIM.Add("5", 11.0);
d_Last10Mins_RQIM.Add("6", 23.0);
如果想按照 value 排序 , 可以
var Last10MinsSortedDict = (from entry in d_Last10Mins_RQIM orderby entry.Value ascending select entry)
.ToDictionary(pair=> pair.Key, pair => pair.Value);
Last10MinsSortedDict 就是排序后的dictionary , 可以像这样引用
var first = Last10MinsSortedDict.First();
string firstVendor = first.Key;
var last = Last10MinsSortedDict.Last();
string lastVendor = last.Key;
或者foreach
foreach (var pair in Last10MinsSortedDict)
{
}
要逆序排就把 ascending 改为 descending
售后响应及时
7×24小时客服热线数据备份
更安全、更高效、更稳定价格公道精准
项目经理精准报价不弄虚作假合作无风险
重合同讲信誉,无效全额退款