Example #1
0
        /// <summary>
        ///     Finds a key-value mapping associated with the greatest key less than or equal to 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 TryLessThanOrEqualTo(
            TK1 key,
            out KeyValuePair <TK1, TV1> valuePair)
        {
            if (_subDictionaryOrdered.TryLessThanOrEqualTo(KeyIn(key), out var kvp))
            {
                valuePair = new KeyValuePair <TK1, TV1>(
                    KeyOut(kvp.Key),
                    ValueOut(kvp.Value));
                return(true);
            }

            valuePair = default;
            return(false);
        }