When I remove Dictionary key add then add new key to dictionary new value is not added to last location. Instead of its adding in the key where it is removed.
Dictionary<int, string> dic = new Dictionary<int, string>();
dic.Add(1, "a");
dic.Add(2, "b");
dic.Add(3, "c");
dic.Remove(2);
dic.Add(4, "d");
I want output as
1 "a"
3 "c"
4 "d"
Not as
1 "a"
4 "d"
3 "c"