Dictionary,hashtable如何排序

Dictionary<string,float> dic=Dictionary<string,float>();

List<KeyValuePair<string, float>> list = new List<KeyValuePair<string, float>>(dic);



list.Sort(delegate(KeyValuePair<string, float> firstPair, KeyValuePair<string, float> nextPair)

{

   return nextPair.Value.CompareTo(firstPair.Value);

}

  

你可能感兴趣的:(Hashtable)