I'm trying to do something like this:
Dictionary dict = Dictionary<string, List<string>>();
dict.Add("someKey1", new List<string>());
dict.Add("orange", new List<string>());
dict.Add("foo", new List<string>());
And then when I iterate over the keys, I'd like them to have retained the order as they were added:
foreach(KeyValuePair<string, string> entry in myDictionary)
{
Console.WriteLine(entry.Key);
}
Should print out:
someKey1
orange
foo
I know that c# Dictionary keys don't retain their order as they were added, so is there another way I can do this so that the keys retain their order?