title: Looking for something like a HashSet, but with a range of values for the key?
body: <p>I'm wondering if there is something like HashSet, but keyed by a range of values. </p>
  
  <p>For example, we could add an item which is keyed to all integers between 100 and 4000. This item would be returned if we used any key between 100 and 4000, e.g. 287.</p>
  
  <p>I would like the lookup speed to be quite close to HashSet, i.e. O(1). It would be possible to implement this using a binary search, but this would be too slow for the requirements. I would like to use standard .NET API calls as much as possible.</p>
  
  <p><strong>Update</strong></p>
  
  <p>This is interesting: <a href="https://github.com/mbuchetics/RangeTree" rel="nofollow">https://github.com/mbuchetics/RangeTree</a></p>
  
  <p>It has a time complexity of O(log(N)) where N is number of intervals, so it's not exactly O(1), but it could be used to build a working implementation. </p>