<p>I've got a dictionary, something like</p>

<pre><code>Dictionary&lt;Foo,String&gt; fooDict
</code></pre>

<p>I step through everything in the dictionary, e.g.</p>

<pre><code>foreach (Foo foo in fooDict.Keys)
    MessageBox.show(fooDict[foo]);
</code></pre>

<p>It does that in the order the foos were added to the dictionary, so the first item added is the first foo returned.</p>

<p>How can I change the cardinality so that, for example, the third foo added will be the second foo returned? In other words, I want to change its "index."</p>

I am
not fully educated in the domain
to properly answer the question, but I have
a feeling
that the dictionary sorts the values according to the key, in order to perform quick key search. This would suggest that the dictionary is sorted by key values according to key comparison. However, looking at
object
methods, I assume they are using hash codes to compare different objects considering there is no requirement on the type used for keys. This is only a guess. Someone more knowledgey should fill in with more detail.
Why are you interested in manipulating the "index" of a dictionary when its purpose is to index with arbitrary types?