c# - Structure to hold 3 columns and lookup for a row fast by any of the columns -


we had 1 hashtable readonly reference list of values this:

internal static readonly hashtable relationcodeacodeb = new hashtable {     {"149", "23"},     {"139", "17"} } 

now need structure can hold 3 values(columns) , value fast of other 2.

something this:

internal static readonly hashtable relationcodeacodebcodec = new hashtable {     {"149", "23", "xx"},     {"139", "17", "xxx"} } string codeb=relationcodeacodebcodec[codea="149"]["codeb"]; 

say object has 3 properties codea, codeb , codec, maintain 3 hash tables, so:

dictionary<string, myobj> dicta, dictb, dictc; 

when creating new myobj, add 3 dictionaries:

dicta[obj.codea] = obj; dictb[obj.codeb] = obj; dictc[obj.codec] = obj; 

looking easy. example coded dicta["149"].codeb

keep tidy in 1 big lookup class, of course.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -