/// <summary> /// Returns the first key-value pair in the dictionary. If the dictionary /// is empty, this method throws an InvalidOperationException. /// </summary> internal static KeyValuePair <TK, TV> FirstKeyValuePair <TK, TV>( BTree <TK, KeyValuePair <TK, TV> > underlying, BoundRange <TK> range) { var lower = range.Lower; var cursor = lower != null ? lower.IsInclusive ? underlying.LessThanOrEqual(lower.Value, underlying.RootCursor) : underlying.LessThan(lower.Value, underlying.RootCursor) : underlying.Begin(); if (cursor.IsEnd) { throw new InvalidOperationException(); } return(cursor.Value); }
public bool TryLessThanOrEqualTo( TK value, out TK result) { return(TryWithCursor(_underlying.LessThanOrEqual(value, _underlying.RootCursor), out result)); }