Does the Enumerator of a Dictionary return key value pairs in the order they were added?

前端 未结 7 1437
暖寄归人
暖寄归人 2020-11-29 11:02

I understand that a dictionary is not an ordered collection and one should not depend on the order of insertion and retrieval in a dictionary.

However, this is what

7条回答
  •  旧巷少年郎
    2020-11-29 11:44

    From MSDN:

    For purposes of enumeration, each item in the dictionary is treated as a KeyValuePair<(Of <(TKey, TValue>)>) structure representing a value and its key. The order in which the items are returned is undefined.

    [Emphasis added]

提交回复
热议问题