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.
SortedList<TKey, TValue>
has a property, Values
, that is an IList<TValue>
. Is it enough? It's fast only for small "sets" of elements. The difference with SortedDictionary
is here http://msdn.microsoft.com/en-us/library/5z658b67(v=vs.80).aspx
Can I ask you why you want to access it "by index"? You can still enumerate it with foreach, you know?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With