Changing the Order in a .NET Generic Dictionary

Posted by pm_2 on Stack Overflow See other posts from Stack Overflow or by pm_2
Published on 2010-03-31T12:45:36Z Indexed on 2010/03/31 14:03 UTC
Read the original article Hit count: 122

Filed under:
|

I have a class that inherits from a generic dictionary as follows:

Class myClass : System.Collections.Generic.Dictionary<int, Object>

I have added a list of values to this in a particular order, but I now wish to change that order. Is there any way (without removing and re-adding) that I could effectively re-index the values; so change the object at index 1 to now be at index 10 for example? For example, this doesn't work:

myClass[1].Index = 10;

© Stack Overflow or respective owner

Related posts about c#

Related posts about generics