Ejemplo n.º 1
0
 /// <summary>
 ///		Select items with keys in the specified range in key order (in the direction from <paramref name="fromRangeKey"/>
 ///		to <paramref name="toRangeKey"/>. Lower limit is inclusive, higher - exclusive
 /// </summary>
 /// <param name="fromRangeKey">
 ///		Selection range start  (inclusive if less than <paramref name="toRangeKey"/> and exclusive otherwise)
 /// </param>
 /// <param name="toRangeKey">
 ///		Selection range end (inclusive if less than <paramref name="fromRangeKey"/> and exclusive otherwise)
 /// </param>
 /// <returns>
 ///		<see cref="IDirectedEnumerable&lt;V&gt;"/>
 /// </returns>
 /// <remarks>
 ///		Note that when going forward the item with range covering <paramref name="fromRangeKey"/> but starting before
 ///		it will not be returned. Similarly when going backwards the last range starting before the end of the range
 ///		will not be returned.
 /// </remarks>
 public IDirectedEnumerable <V> Select(K fromRangeKey, K toRangeKey)
 {
     C5.IDirectedEnumerable <C5.KeyValuePair <K, V> > seq;
     if (fromRangeKey.CompareTo(toRangeKey) < 0)
     {
         // ascending
         seq = _dictionary.RangeFromTo(fromRangeKey, toRangeKey);
     }
     else
     {
         // descending
         seq = _dictionary.RangeFromTo(toRangeKey, fromRangeKey).Backwards();
     }
     return(new C5DirectedEnumerable <V>(new DictionaryEnumerableValueAdapter <K, V>(seq)));
 }