HashTable CopyTo order of elements

I am trying to find out why the order I use to fill the HashTable is not the same on the copied array. Any help please?

		        ofrendas.Add ("wise", wise);
			ofrendas.Add ("keys", keys);
			ofrendas.Add ("vision", vision);
			ofrendas.Add ("time", time);
			ofrendas.Add ("mixture", mixture);

			string[] keyse = new string[5];
	
			ofrendas.Keys.CopyTo (keyse, 0);

			print ("kkkss " + keyse [0]);
			print ("kkkss " + keyse [1]);
			print ("kkkss " + keyse [2]);
			print ("kkkss " + keyse [3]);
			print ("kkkss " + keyse [4]);

HashTables use a hash function to store the values. For every keys, it applies a function on the key ( in your case “keys”, “vision”, “time” and “mixture”) and returns a position in memory for this particular key.

The hash function DOES NOT guarantee to preserve the ordering of which you added the elements. It is how hashtables are made. If you were counting on this particular behavior, I’d suggest to use a different data structures, such as List or Array.