API 2 Dictionary Order

We’re creating an API2 dictionary in a specific order and returning it to a calling method. The dictionary is not modified in any way after it is created. The calling method loops the returned dictionary using For Each and the new DictionaryEntry class. Is there any chance that the order of the dictionary will be different than when it was created?

As far as I’m aware, the Xojo framework makes no guarantee about the order the keys are returned. Most programming languages don’t.

It’s always different. But feel free to keep an array of the ordered keys.

There is very little chance that For Each will return the items in the order they were created. They’re almost guaranteed to be different, but there is a very, very small chance that they could be the same. It would be a weird coincidence, though.

You have a 0% chance that the order will be different… With a one item dictionary. 50% chance with two items and so on.