Search code examples
c#.netperformancedictionaryordereddictionary

Is there any alternative of Dictionary in .NET?


I have a requirement of using a dictionary in the project but as we know that they are only accessible using the keys and not using the indexes, and I want to access the items in dictionary using indexes. So I fiddle over the web and found out about OrderedDictionary as they are accessible using both the indexes and keys but they have some performance issue and as I am reading/writing the dictionary every minute of the day so it's not a good idea to use OrderedDictionary.

So lastly my question in here is that is there any alternative available which gives me functionality of Dictionary and I can also access it using indexes and doesn't cause a performance issue.


Solution

  • in response to your comment that you are only expecting a hundred updates a minute, this is very little work - practically nothing. You can still use an OrderedDictionary, performance will not be an issue for you.