I have a Dictionary data type. My question is, is Dictionary.Keys.ToList()[i] always correspond to Dictionary.Values.ToList()[i] ? That is, will the following test always passes
public void DictionaryTest(int i, Dictionary<U,T> dict)
{
var key = dict.Keys.ToList()[i];
Assert.AreEqual(dict[key], dict.Values.ToList()[i]);
}
Checking the MSDN entry for Dictionary.Keys Property: