Hi all,
I may have got the subject wrong, so I appologize if it's not clear.
I have an application in which I have to translate keys to values and vice versa.
The current most efficient solution I see for this problem is to keep 2 Dictionary objects so I can translate both ways (it's no more than 1000 strings, so it's not very expensive in memory consumption), since I don't want to iterate over the Dictionary every time I make a translation.
Is there a better way to do this
In Java, we hold 2 Map objects for that, and I wanted to know if the .net has a better implementation.
Thanks.

Hashtable get key for a specified value efficiently
ddCONFUSED
That's what I thaught too.
However, today, a need discovered to let the user manipulate this data structure, so I've written a class that represents it, and I'll keep a list of this type of objects and I'll perform my convertions with this class.
Thanks anyway.
austriana
Two dictionaries are the most efficient way in .NET and considering that you're using strings the memory overhead won't be too bad. However there are alternatives as well. For example you can store the strings in a sorted collection and then create a dictionary that maps keys to indexes. When searching by key use the dictionary. When searching by value use a binary search on the collection. Updates to the collection are more expensive in this case. I've also seen at least one example floating around of a collection that does what you want but I believe it used to dictionaries as well.
Michael Taylor - 1/24/07
http://p3net.mvps.org