Click to See Complete Forum and Search --> : Associative Array / Hash Table?


aspekt9
January 21st, 2010, 11:12 AM
I need an array or list or hash table that will allow me to have keys that are not unique, for example:

"table_name1", "error in field name"
"table_name2", "error in field address"
"table_name2", "error in field zipcode"
"table_name2", "error in field other"

etc.. there will be multiple keys but they could have the same names. Another issue is I could be storing up to 1,000,000+ elements so performance is an issue. Any ideas what data structure I can use?

nelo
January 21st, 2010, 11:16 AM
Hi,

Are the values unique? Perhaps you can switch the mapping. Any collection that doesn't support unique keys is unlikely to give a performance as good as the hash table or generic dictionary.

aspekt9
January 21st, 2010, 11:18 AM
The values will be unique yes, I never thought about switching the mapping, that's a good idea.

mariocatch
January 21st, 2010, 11:37 AM
NameValueCollection<T> I think handles multiple KVP's with the same Key, but different values.