About a dictionary, removing and adding items, and their order.

I had a weird problem today using a Dictionary. The process involved removing and adding data, and then printing the data. I assumed that it was ordered. I was wrong! Let me show you: var dictionary = new Dictionary<int, string>(); dictionary.Add(5, “The”); dictionary.Add(7, “quick”); dictionary.Add(31, “brown”); dictionary.Add(145, “fox”); dictionary.Remove(7); // remove the “quick” entry After a […]