Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Your implementation of Equals violates the <a href="http://msdn.microsoft.com/en-us/library/ms173147%28VS.80%29.aspx" rel="nofollow noreferrer">guidelines for overriding Equals</a>. In particular your implementation does not satisfy the transitivity rule:</p> <blockquote> <ul> <li>if <code>x.Equals(y) &amp;&amp; y.Equals(z)</code> returns true, then <code>x.Equals(z)</code> returns true.</li> </ul> </blockquote> <p>Breaking this guideline is a bad idea and can lead to problems and confusion. I would recommend that you do not do this.</p> <p>I would avoid storing intervals as keys in a dictionary altogether. You can put the list of intervals for a specific key as a <em>value</em> in the dictionary if you like, but it shouldn't be part of the key.</p> <p>When you are searching to find an interval you can first use the dictionary key to get the list of intervals for that key and then iterate over the intervals to find one that overlaps with your parameter. If the intervals are not overlapping for a specific key then you can sort them and use a binary search to find a specific interval. If the intervals for a specific key can overlap you can look at other data structures such as an <a href="http://en.wikipedia.org/wiki/Interval_tree" rel="nofollow noreferrer">interval tree</a>.</p> <p><strong>Related question</strong></p> <ul> <li><a href="https://stackoverflow.com/questions/1580185/data-structure-for-quick-time-interval-look-up">Data structure for quick time interval look up</a></li> </ul>
 

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