コード例 #1
0
        /// <summary>
        ///     Finds a key-value mapping associated with the greatest key strictly less than the given key.
        ///     Outputs the valuePair if found and returns true.  Otherwise, returns false.
        /// </summary>
        /// <param name="key"></param>
        /// <param name="valuePair"></param>
        /// <returns></returns>
        public bool TryLessThan(
            TK1 key,
            out KeyValuePair <TK1, TV1> valuePair)
        {
            if (_subDictionaryOrdered.TryLessThan(KeyIn(key), out var kvp))
            {
                valuePair = new KeyValuePair <TK1, TV1>(KeyOut(kvp.Key), ValueOut(kvp.Value));
                return(true);
            }

            valuePair = default;
            return(false);
        }