Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The problem is with comparisons between the keys you are storing in the <code>Dictionary</code> and the keys you are trying to look up.</p> <p>When you add something to a <code>Dictionary</code> or access the indexer of a <code>Dictionary</code> it uses the <code>GetHashCode()</code> method to get a hash value of the key. The hashcode for a <code>Tuple</code> is unique to that instance of the <code>Tuple</code>. This means that unless you are passing in the exact same instance of the <code>Tuple</code> class into the indexer, it will not find the previously stored value. Your usage of <code>mergedDict[Tuple.Create(...</code> creates a brand new Tuple with a different hash code than is stored in the <code>Dictionary</code>.</p> <p>I would recommend creating your own class to use as the key and implementing <code>GetHashCode()</code> and the Equality methods on that class. That way the Dictionary will be able to find what you previously stored there.</p> <p>More: The reason this is confusing to a lot of people is that for something like <code>String</code> or <code>Int32</code>, <code>String.GetHashCode()</code> will return the same hash code for two different instances that have the same value. A more specialized class such as <code>Tuple</code> doesn't always work the same. The implementor of <code>Tuple</code> could have gotten the hash code of each input to the <code>Tuple</code> and added them together (or something), but running Tuple through a decompiler you can see that this is not the case.</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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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