Note that there are some explanatory texts on larger screens.

plurals
  1. PO.NET container for two-way conversion data?
    primarykey
    data
    text
    <p>I have conversion tables I need to contain in memory for fast access. Until now I used a simple <code>Hashtable</code> were the Key was the internal code, and the Value was an object holding the external code and other meta-data.</p> <p>Now we need to have a reverse look-up, meaning to get the internal code based on the external code. I could only come up with the following options:</p> <ol> <li>Have another container for this look-up, Hashtable containing only the internal code as Value to prevent more redundancy.</li> <li>Use the same container I use now, and store those objects again now using the the external code as the Key (have a prefix to prevent collisions).</li> <li>Don't pull data using Keys, but iterate through the Values contained under the same container to find the requested object ( O(n), same memory usage ).</li> </ol> <p>The container is being lazy-loaded, so options 1&amp;2 usually won't perform under the worst-case scenario.</p> <p>Thoughts anyone? Please tell me there's some efficient container I could use for that, which I missed!</p> <p><strong>* EDIT *</strong></p> <p>Being a GC'd framework, and accepting the fact I'd have to have two conversion arrays (Dictionaries), would the following lines of code actually mean I stored only one object on memory, and then two pointers for it, under two different hashed-cells?</p> <pre><code>Dictionary&lt;K1,V&gt; forward; Dictionary&lt;K2,V&gt; reverse; //... void Add(V myObject) { // myObject being the BLL object forward.Add(myObject.InternalCode, myObject); reverse.Add(myObject.ExternalCode, myObject); } </code></pre> <p>Itamar.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload