I add a new item into the RoutingList but after the first delete the order is wrong.
public Dictionary<int, Route> RoutingList = new Dictionary<int, Route>();
For example:
1,route
2,route
3,route
4,route
5,route
Now I delete the first one.
2,route
3,route
4,route
5,route
By adding the next item I get this list:
6,route
2,route
3,route
4,route
5,route
And after this the first one (6) will deleted. But this is wrong. I want to delete the No. 2.
Why?
int key = RoutingList.LastOrDefault().Key;
RoutingList.Add(key + 1, tmpRoute);
if (RoutingList.Count == 5)
{
RoutingList.Remove(RoutingList.First().Key);
}