How to insert as first element in dictionary?

前端 未结 5 1556
伪装坚强ぢ
伪装坚强ぢ 2021-01-11 18:59

I have a dictionary structure, with multiple key value pairs inside.

myDict.Add(key1, value1);
myDict.Add(key2, value2);
myDict.Add(key3, value3);
         


        
5条回答
  •  無奈伤痛
    2021-01-11 19:40

    Dictionary Should not be used to sort objects, it should rather be used to look up objects. i would suggest something else if you want to have it sort the objects too.

    If you expand the Dictionary, there are no rule that would stop it from mixing up your List.

提交回复
热议问题